「display_all.c」の編集履歴(バックアップ)一覧はこちら

display_all.c」(2007/08/01 (水) 08:04:31) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

//c #include <stdio.h> #include <stdlib.h> #include <string.h> #define LINE_SIZE 256 extern FILE *txtfile; //すべての行を表示 void display_all(void){ char str[LINE_SIZE]; //行保存用の配列 int i = 1; //行番号 while(!feof(txtfile)){ if(fgets(str, LINE_SIZE - 1, txtfile) == NULL) strcpy(str, "\n"); if(ferror(txtfile)){ printf("ファイルの読み込み失敗\n"); break; } if(!feof(txtfile)) printf("%8d: %s", i, str); else{ if(strcmp(str, "\n") != 0) printf("%8d: %s\n", i, str); } i++; } return; }

表示オプション

横に並べて表示:
変化行の前後のみ表示: