C/C++の宿題片付けます 153代目at TECH
C/C++の宿題片付けます 153代目 - 暇つぶし2ch671:デフォルトの名無しさん
11/11/26 01:28:58.74
>>670


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
int i = 0;
char *ptr;
char str[128];
FILE *fin;

if (argc == 1) {
ptr = str;
scanf("%s", str);
while (*ptr++) i++;
} else {
if ((fin = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "Input file open error\n");
exit(EXIT_FAILURE);
}
while (fgetc(fin) != EOF) i++;
fclose(fin);
}
printf("%d\n", i);

return 0;
}



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