?? 9-24.txt
字號:
/* 范例:9-24 */
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
void main(int argc,char *argv[])
{
int file1,file2;
char buf[512];
if((file1 = open(argv[1],O_RDONLY))==-1)
{
printf("Read file %s Error!\n",argv[1]);
exit(1);
}
if((file2 = open(argv[2], O_WRONLY|O_CREAT))==-1)
{
printf("Create file %s Error!\n",argv[2]);
exit(1);
}
while(read(file1,buf,512)>0)
write(file2,buf,512);
close(file1);
close(file2);
}
程序執(zhí)行結(jié)果:
D:\TC>p9-24 xx.txt out.txt
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -