C/C++の宿題を片付けます 109代目 at TECH
[2ch|▼Menu]
205:デフォルトの名無しさん
08/06/11 00:59:04
>>165
#include<stdio.h>
#include<stdlib.h>
#define SRC_FILE "test.txt"
#define DST_FILE "sample.txt"
int main()
{
FILE *fs, *fd;
long size, i;
char *buf;
if((fs = fopen(SRC_FILE, "r")) == NULL) {
perror(SRC_FILE);
return 1;
}
if((fd = fopen(DST_FILE, "w")) == NULL) {
fclose(fs);
perror(DST_FILE);
return 1;
}
fseek(fs, 0, SEEK_END);
size = ftell(fs);
fseek(fs, 0, SEEK_SET);
buf = malloc(size);
size = fread(buf, 1, size, fs);
for(i = size - 1; i >= 0; i --)
fputc(buf[i], fd);
free(buf);
fclose(fd);
fclose(fs);
return 0;
}


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

5023日前に更新/317 KB
担当:undef