資源簡介
代碼片段和文件信息
/*?Chapter?1.?Basic?cp?file?copy?program.?C?library?Implementation.?*/
/*?cpC?file1?file2:?Copy?file1?to?file2.?*/
#include?
#include?
#define?BUF_SIZE?256
int?main?(int?argc?char?*argv?[])
{
FILE?*inFile?*outFile;
char?rec[BUF_SIZE];
size_t?bytesIn?bytesOut;
if?(argc?!=?3)?{
fprintf?(stderr?“Usage:?cp?file1?file2\n“);
return?1;
}
/*?In?later?chapters?we‘ll?use?the?more?secure?functions?such?as?fopen_s
?*?See?http://msdn.microsoft.com/en-us/library/8ef0s5kh%28VS.80%29.aspx?
?*?Note?that?this?project?defines?the?macro?_CRT_SECURE_NO_WARNINGS?to?avoid?a?warning?*/
inFile?=?fopen?(argv[1]?“rb“);
if?(inFile?==?NULL)?{
perror?(argv[1]);
return?2;
}
outFile?=?fopen?(argv[2]?“wb“);
if?(outFile?==?NULL)?{
perror?(argv[2]);
fclose(inFile);
return?3;
}
/*?Process?the?input?file?a?record?at?a?time.?*/
while?((bytesIn?=?fread?(rec?1?BUF_SIZE?inFile))?>?0)?{
bytesOut?=?fwrite?(rec?1?bytesIn?outFi
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2010-09-27?17:43??WSP4_Examples\CHAPTR01\
?????文件????????1187??2010-06-13?09:59??WSP4_Examples\CHAPTR01\cpC.c
?????文件?????????503??2010-06-13?09:59??WSP4_Examples\CHAPTR01\cpCF.c
?????文件?????????982??2010-06-13?09:59??WSP4_Examples\CHAPTR01\cpU.c
?????文件????????1264??2010-06-13?09:59??WSP4_Examples\CHAPTR01\cpUC.c
?????文件????????1292??2010-06-13?09:59??WSP4_Examples\CHAPTR01\cpW.c
?????文件????????1377??2010-06-13?09:59??WSP4_Examples\CHAPTR01\cpwFA.c
?????目錄???????????0??2010-12-10?09:42??WSP4_Examples\CHAPTR02\
?????文件????????1532??2010-06-13?09:59??WSP4_Examples\CHAPTR02\Cat.c
?????文件?????????843??2010-06-13?09:59??WSP4_Examples\CHAPTR02\cci.C
?????文件????????1778??2010-12-10?09:42??WSP4_Examples\CHAPTR02\cci_f.C
?????文件????????2371??2010-06-13?09:59??WSP4_Examples\CHAPTR02\cci_fFA.C
?????文件?????????420??2010-06-13?09:59??WSP4_Examples\CHAPTR02\CD.C
?????文件?????????754??2010-06-13?09:59??WSP4_Examples\CHAPTR02\PWD.C
?????文件????????1008??2010-06-13?09:59??WSP4_Examples\CHAPTR02\PWDA.C
?????目錄???????????0??2010-09-27?17:43??WSP4_Examples\CHAPTR03\
?????文件????????2197??2010-06-13?09:59??WSP4_Examples\CHAPTR03\FreeSpace.c
?????文件????????2202??2010-06-13?09:59??WSP4_Examples\CHAPTR03\GETN.C
?????文件????????7861??2010-06-13?09:59??WSP4_Examples\CHAPTR03\LsREG.c
?????文件????????7319??2010-07-08?14:15??WSP4_Examples\CHAPTR03\lsW.C
?????文件????????7872??2010-06-13?09:59??WSP4_Examples\CHAPTR03\RecordAccess.c
?????文件????????2437??2010-06-13?09:59??WSP4_Examples\CHAPTR03\RecordAccessTestDataGenerate.cpp
?????文件????????3993??2010-06-13?09:59??WSP4_Examples\CHAPTR03\TAIL.C
?????文件????????3213??2010-06-13?09:59??WSP4_Examples\CHAPTR03\TestLock.c
?????文件????????1892??2010-06-13?09:59??WSP4_Examples\CHAPTR03\TOUCH.C
?????目錄???????????0??2010-09-27?17:43??WSP4_Examples\CHAPTR04\
?????文件????????1828??2010-06-13?09:59??WSP4_Examples\CHAPTR04\CNTRLC.C
?????文件????????5113??2010-08-16?16:53??WSP4_Examples\CHAPTR04\EXCPTION.C
?????文件????????4164??2010-06-13?09:59??WSP4_Examples\CHAPTR04\toupper.c
?????文件????????3746??2010-06-13?09:59??WSP4_Examples\CHAPTR04\toupperX.c
?????目錄???????????0??2012-01-22?14:50??WSP4_Examples\CHAPTR05\
............此處省略1639個文件信息
- 上一篇:putty 串口工具源碼
- 下一篇:zprotect 1.6 脫殼工具()
評論
共有 條評論