日日行,不怕千万里;时时学,不怕千万卷
分类: LINUX
2008-05-14 16:29:44
//file : lock.c #i nclude #i nclude #i nclude #i nclude #i nclude int main() { int file_desc; int save_errno; file_desc = open("/tmp/LockFile.test", O_RDWR | O_CREAT | O_EXCL, 0444); if (file_desc < 0) { save_errno = errno; printf("Open failed with error is %d\n", save_errno); } else { printf("Open succeeded\n"); } exit(EXIT_SUCCESS); } |