文件黑洞
ayanami_rei_devilxq吧
全部回复
仅看楼主
level 5
#include
char buf1[] = "abcdefghij";char buf2[] = "ABCDEFGHIJ";#define FILE_MODE 0644int main(void){ int fd; if ((fd = creat("file.hole", FILE_MODE)) < 0 ) { printf("creat error"); } if (write(fd, buf1, 10)!= 10) { printf("buf1 write error"); } if (lseek(fd, 40, SEEK_SET) == -1) { printf("lseek error"); } if (write(fd, buf2, 10)!= 10) { printf("buf2 write error"); } getchar(); exit(0);}
2005年11月16日 12点11分 1
1