分类: LINUX
2008-08-20 18:17:17
//file:lock.c #include #include #include #include #include intmain() { intfile_desc; intsave_errno; file_desc=open("/tmp/LockFile.test",O_RDWR|O_CREAT|O_EXCL,0444); if(file_desc<0) { save_errno=errno; printf("Openfailedwitherroris%d\n",save_errno); } else{ printf("Opensucceeded\n"); } exit(EXIT_SUCCESS); }