將開發(fā)過程中較好的內(nèi)容做個(gè)收藏,下邊代碼內(nèi)容是關(guān)于C語言基礎(chǔ):文件拷貝的代碼蟀淮。
#include <stdio.h>
int main(void)
{
? int letter;
? if ((input = fopen("\CONFIG.SYS", "r")) == NULL)
? ? printf("Error opening \CONFIG.SYSn");
? else if ((output = fopen("\CONFIG.TST", "w")) == NULL)
? ? printf("Error opening \CONFIG.TSTn");
? else
? ? {
? ? ? while ((letter = fgetc(input)) != EOF)
? ? ? ? fputc(letter, output);
? ? }
return 1;
}