C/C++の宿題をやらせて、お兄ちゃん 22代目
■ このスレッドは過去ログ倉庫に格納されています
0234デフォルトの名無しさん
NGNG# include <stdio.h>
int main(void)
{
int c;
FILE *file = fopen("あるファイル", "r");
int nbytes = 0, nlines = 1;
while((c = getc(file)) != EOF) {
if(c == '\n') nlines++;
nbytes++;
}
fclose(fp);
printf("行数:%d バイト数:%d\n", nlines, nbytes);
}
■ このスレッドは過去ログ倉庫に格納されています