Home > Software engineering >  ? Established using MFC dialog box procedure, and function realization, read a file, modify the file
? Established using MFC dialog box procedure, and function realization, read a file, modify the file

Time:10-07

Text format correct software
Under this directory two e-book "sea of clouds jade bow margin" and "makino meteor" is made up of other formats ebook conversion to come over, so contains a large number of line, the line is not a paragraph, and in each row in the same position, the line feed a will increase the size of the file, second can cause blank while reading too much (e.g., reading in the mobile phone), try to write a software, to the specified directory of all these meaningless newline character in the text file to remove them, requires the use of a graphical user interface,



Hope to be able to know the specific code, methods to separate, I know, specific code just don't know how to write or don't know at a certain position in the program,
The great god help me, (we need to do course design close to the deadline, or didn't find the right code, urgent urgent,,,)

Based on the dialog box procedure, then the function implementation, read the file, modify the file content (the back of the line is always good word wrap a piece of blank, to remove the newline, text automatically fill up behind), to write to file

CodePudding user response:

CodePudding user response:

The FILE * fin; * fout
Fin=fopen (" source. TXT ", "rb")
Fout=fopen (" target. TXT ", "wb");

While (1)
{
Char ch=fgetc (fin);
If (feof (fin) break;
If (ch>=0 x30) fputc (ch, fout);
}

The fclose (fin);
The fclose (fout);

CodePudding user response:

The file content is read into memory, and then modified in memory, and then write back to the file

CodePudding user response:

  • Related