函數名:sopen
功能:打開文件欣賞。
用法:int sopen (char * pathname,int access,int sh flag,int permiss);
程序示例:
# include & ltio.h & gt
# include & ltfcntl.h & gt
# include & ltsys \ stat.h & gt
# include & ltprocess.h & gt
# include & ltshare.h & gt
# include & ltstdio.h & gt
int main(void)
{
int句柄;
int狀態;
handle = sopen("c:\\autoexec.bat ",O_RDONLY,SH_DENYNO,S _ IREAD);
如果(!手柄)
{
printf("sopen失敗\ n ");
退出(1);
}
status = access(" c:\ \ autoexec . bat ",6);
如果(狀態== 0)
printf("允許讀/寫訪問\ n ");
其他
printf("不允許讀/寫訪問\ n ");
關閉(手柄);
返回0;
}