sopen

函式名: sopen sopen

函式名: sopen
功 能: 打開一已分享檔案
用 法: int sopen(char *pathname, int access, int shflag, int permiss);
程式例:
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#include <process.h>
#include <share.h>
#include <stdio.h>
int main(void)
{
int handle;
int status;
handle = sopen("c:\\autoexec.bat", O_RDONLY, SH_DENYNO, S_IREAD);
if (!handle)
{
printf("sopen failed\n");
Exit(1);
}
status = access("c:\\autoexec.bat", 6);
if (status == 0)
printf("read/write access allowed\n");
else
printf("read/write access not allowed\n");
close(handle);
return 0;
}

相關詞條

相關搜尋

熱門詞條

聯絡我們