?? test6_4.txt
字號:
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#define NEWFILE (O_WRONLY|O_CREAT|O_TRUNC)
int main(void)
{
char buf1[ ]={"abcdefghij"};
char buf2[ ]={"1234567890"};
int fd;
int length;
if(fd=open("test.hole", NEWFILE, 0600)==-1)
{
printf("ERROR, OPEN WRITE FILE FAILED: \n", sys_errlist[errno]);
exit(255);
}
length=strlen(buf1);
if(write(fd, buf1,length)!=length)
{
printf("ERROR, OPEN WRITE FILE FAILED: \n", sys_errlist[errno]);
exit(255);
}
if(lseek(fd, 50, SEEK_SET)==-1)
{
printf("ERROR, LSEEK FAILED: \n", sys_errlist[errno]);
exit(255);
}
length=strlen(buf2);
if(write(fd, buf2,length)!=length)
{
printf("ERROR, OPEN WRITE FILE FAILED: \n", sys_errlist[errno]);
exit(255);
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -