This program is used to eliminate the unrecognizable small black blocks when Linux open under Windows. Small black blocks Cause Analysis: Under Linux, some text files (one carriage return of the file) is not necessarily ended with "/ d / A", sometimes saving the '/ d' character, so it leads to The file is not recognized under Windows, the end of the tail character, the display is small, such as in the notepad under Windows. If you end with "/ D / A", a small black block is not generated under Windows, you can identify. The solution here is to save the '/ d' character of the province, so it is normal. Here is the code part and have passed the test. / * LTOW.CPP ZHANGGGDLT 2004.12.1 * / # include
/ * This function is used to exchange linux txt (cpp / c etc) to windows' files. So the unrecognized charactars can be recognized by exchange. * / Int processFile (const char * sfile, const char * dfile) {FILE * sfp = NULL; File * DFP = NULL; char * str = null; char Temp [MAX_LEN]; int Strlen = 0; if (! (Sfp = fopen (sfp = fopen (sfip = fopen (sfile, "r"))) RETURN -1; IF (! DFP = FOPEN (DFILE, "W"))) Return -2; while (str = fgets (TEMP, MAX_LEN, SFP)) {// printf ("% s", str); // show (STR); strlen = Strlen (STR); if (* (Str Strlen-2)! = 0x0D) {* (Str Strlen-1) = 0x0d; * (Str Strlen) = 0x0a; * (Str Strlen 1) = 0x00;} // Printf ("% s", str); // show (str); FPUTS (STR, DFP);} fclose (sfp); fclose (DFP); Return 0;}