|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| chiwing (154) | |
|
how to delete a word from a file? the delete address is filepointer = 32 can u give an example? thanks | |
|
|
|
| johnkravetzki (98) | |
| and how are those words stored in file? one word per line? | |
|
Last edited on
|
|
| chiwing (154) | |
| stored in file use WriteFile() for win32 api | |
|
|
|
| Duoas (5974) | |
|
Typically the answer is: read source file line by line/word by word/etc make changes save to temp file close files delete source file rename temp file to source file another possibility is: load source file into memory (say, a std::deque) make changes save memory to source file Good luck! | |
|
|
|
| chiwing (154) | |
|
hi, Duoas , i choose to use the method of load source file into memory (::deque) the line is "goes Goes I am Phappy"--> i want to change to "goes Goes I am happy" change the line "goes Goes I am Phappy"--> " " by ReadFile(happy.txt,...) // put the line into a wstring setFilePointer( ); writefile(); the problems come, i just know how to insert string into a file, by how to override or delete, it really a problem~ ~ | |
|
Last edited on
|
|
| chiwing (154) | |
|
ReplaceFile() Replaces one file with another file, with the option of creating a backup copy of the original file. The replacement file assumes the name of the replaced file and its identity. http://msdn.microsoft.com/en-us/library/aa365512(VS.85).aspx DeleteFile Function() Deletes an existing file. http://msdn.microsoft.com/en-us/library/aa363915(VS.85).aspx MoveFile Function Moves an existing file or a directory, including its children. http://msdn.microsoft.com/en-us/library/aa365239(VS.85).aspx | |
|
Last edited on
|
|
| chiwing (154) | |
|
To write string line by line use escape http://www.cplusplus.com/forum/windows/11863/ | |
|
|
|