C/C++の宿題を片付けます 109代目
at TECH
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