字符包括汉字与ASC字符,是要麻烦许多,不过可以用另一种方式来处理:
先将文件中的字母、数字、空格、符号全部转换成全角字符,即将两个byte的字符;然后再做文件内容倒置处理;
算法描述如下:
==============================================
1.open a file with read mode;
2.travel every letter;
3.when the letter's ascii value less then 255, replace it with chs char;
4.when file go to eof flags,reset file's pointer (start_fp), and record the pointer as other pointer, then set file pointer to the file end;
5.travel again with (fp-=2);
6.write a new file with each char;
7.when fp go to the file head , exit loop;
8.closed all files;