複製鏈接
請複製以下鏈接發送給好友

unlock

(編程語言)

鎖定
unlock是一個電腦運行進程,其作用為指解除文件共享鎖。
外文名
unlock
類    型
詞語
功    能
解除文件共享鎖
用    法
int unlock

目錄

unlock功 能

解除文件共享鎖

unlock用 法

int handle, long offset, long length);

unlock程序例

#include
#include
#include
#include
#include
#include
int main(void)
{
int handle, status;
long length;
handle = sopen("c:\\autoexec.bat",O_RDONLY,SH_DENYNO,S_IREAD);
if (handle < 0)
{
printf("sopen failed\n");
exit(1);
}
length = filelength(handle);
status = lock(handle,0L,length/2);
if (status == 0)
printf("lock succeeded\n");
else
printf("lock failed\n");
status = unlock(handle,0L,length/2);
if (status == 0)
printf("unlock succeeded\n");
else
printf("unlock failed\n");
close(handle);
return 0;
}