Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Function .... no MFC 2

Status
Not open for further replies.

lGOOODl

Programmer
Dec 4, 2001
31
DK
Hi,

I was hoping some of you great guy/girls would help me. =)
How can I remove some text from the end of a file (whit fstream ?)

Thx
GOOOD
 
Copy your file to another file,while copying if you found the text that you want to remove,dont do anything.
 
That would be a noob salution ... I would like to delete some bytes from the end of a file !
 
Read the entire file into a buffer. Close the file. Find the text that you're looking for inside the buffer and remove it. Reopen the file for writing. Dump the buffer into the file.
 
Get a handle with [red]CreateFile()[/red]
then move the file pointer with [red]SetFilePointer()[/red]to where you want to chop off the remaining bytes
then do [red]SetEndOfFile()[/red] on the handle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top