delete one character in file
-
I use Visual C++ to program. Can I delete one character in one file without use a tempFile? And How? For example, - my file contains: "Life is so short"; - the file pointer is at the beginning of file - after I open file for reading & writing, the file contains "ife s o hort"; thanks do not understand everything
-
I use Visual C++ to program. Can I delete one character in one file without use a tempFile? And How? For example, - my file contains: "Life is so short"; - the file pointer is at the beginning of file - after I open file for reading & writing, the file contains "ife s o hort"; thanks do not understand everything
six_billion wrote: Can I delete one character in one file without use a tempFile? And How? Yes. In summary:* Open file for reading
-
Read entire file into buffer
-
Close file
-
Locate and delete character from buffer
-
Open file for writing
-
Write buffer to file
-
Close file
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
-
I use Visual C++ to program. Can I delete one character in one file without use a tempFile? And How? For example, - my file contains: "Life is so short"; - the file pointer is at the beginning of file - after I open file for reading & writing, the file contains "ife s o hort"; thanks do not understand everything
well, you open the file, read the data, close the file, modify the data and write back the data into it. you can't directly modify a file. ( afaik ).
Maximilien Lincourt Your Head A Splode - Strong Bad
-
well, you open the file, read the data, close the file, modify the data and write back the data into it. you can't directly modify a file. ( afaik ).
Maximilien Lincourt Your Head A Splode - Strong Bad
Maximilien wrote: you can't directly modify a file. ( afaik ). Well you can using a memory mapped file, but this is a bit of trickery.;) Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"