|
TstringList's LoadFromFile generally only handles text, if there is a text end of the text (0x1a) or string end value (0x00) in your file, it has a problem.
C / C ++ file processing capability is very, the simplest, with the C standard function to achieve your requirements
1. Use rename to rename mytxt.txt, such as Mytxt.bak
2. Open file mytxt.bak with fopen, and create a new file mytxt.txt
3. Read the file mytxt.bak by getC, and determine if it is a mess, if yes, change to space to write mytxt.txt, otherwise write file mytxt.txt
4. Repeat 3 until myTXT.BAK file end
5. If necessary, delete the file mytxt.bak |
|