I checked the file control in C language and wrote a number of lines to display.
After processing each line of characters read with an array, printing is what I want. The thought is very simple, but it is not implemented ,.~~~ I used another method ..
Code:
- # Include <stdio. h>
- # Include <stdlib. h>
- # Include <conio. h>
- # Define size 250
- Int mark = 0;
- Int main ()
- {
- File * FPR, * FPW;
- Char filename [size];
- Char buff [size];
- Char put1 = ':';
- Puts ("enter the name of the file to be annotated ");
- Gets (filename );
- Fflush (stdin );
- If (FPR = fopen (filename, "R") = NULL)
- {
- Fprintf (stderr, "error opening to file ");
- Exit (1 );
- }
- If (FPW = fopen ("file .txt", "W") = NULL)
- {
- Fprintf (stderr, "error opening to file ");
- Exit (1 );
- }
- Puts ("the comment file is as follows ");
- While (! Feof (FPR ))
- {
- Fgets (buff, size, FPR );
- Printf ("% d", ++ mark );
- Printf ("% C", put1 );
- Printf ("% s/n", buff );
- Fprintf (FPW, "% d", mark );
- Fputc (put1, FPW );
- Fputs (buff, FPW );
- }
- Fclose (FPR );
- Fclose (FPW );
- Return 0;
- }