Jul 11, 2009 at 7:33am UTC
how to delete a word from a file?
the delete address is filepointer = 32
can u give an example?
thanks
Jul 11, 2009 at 8:31am UTC
and how are those words stored in file? one word per line?
Last edited on Jul 11, 2009 at 8:31am UTC
Jul 11, 2009 at 8:41am UTC
stored in file use WriteFile() for win32 api
Jul 11, 2009 at 3:10pm UTC
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!
Jul 12, 2009 at 5:27am UTC
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 Jul 12, 2009 at 5:40am UTC
Jul 12, 2009 at 5:50am UTC
Last edited on Jul 12, 2009 at 6:24am UTC