Article View: cn.bbs.comp.program
Article #2541Re: unix�����ļ�
From: ��ɵ
Date: Mon, 15 Dec 1997 00:00
Date: Mon, 15 Dec 1997 00:00
29 lines
1096 bytes
1096 bytes
�� �� than (�Ϻ���) �Ĵ������ᵽ: ��
: It is different between SYSV and BSD, try flock() or lockf().
: man flock
: or
: man lockf
: to get help, good luck!
�ҵ�����Solaris2.5.2�£����æ��һ�������
#include <stdio.h>
#include <sys/file.h>
main()
{
FILE *fp;
fp=fopen("file_to_lock", "r");
flock("file_to_lock", LOCK_EX);
printf("file is being lock, to unlock , press <enter>\n");
getchar();
flock("file_to_lock", LOCK_UN);
fclose(fp);
return;
}
--
[m[1;34m�� ��Դ:���人���ƻƺ�վ s1000e.whnet.edu.cn��[FROM: 202.96.128.92][m
Technical Details
Message-ID:
<3M8TgD$tDF@bbs.whnet.edu.cn>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: fc86e,6af83e69f10f2af3,start X-Google-Attributes: gidfc86e,public From: tibet.bbs@bbs.whnet.edu.cn (��ɵ) Subject: Re: unix�����ļ� Date: 1997/12/15 Message-ID: <3M8TgD$tDF@bbs.whnet.edu.cn> X-Deja-AN: 298327276 X-Filename: Programming/M.882150637.A Organization: �人���ƻƺ�վ Newsgroups: cn.bbs.comp.program