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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can the file pointer be moved?

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
0
0
DE
Hello, all!

I've opened a file:
Code:
CString path="myfile.txt"
hFile = CreateFile ((LPCTSTR) path,GENERIC_WRITE | GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);

How can I append something to it. I mean WriteFile will overwrite everything in the file and I need to append some text at the end of the file.

Thanx
 
You need [tt]SetFilePointer[/tt]:
Code:
   SetFilePointer(hFile, 0, NULL, FILE_END);

[tt]_______________________________________
Roger [pc2]
The Eileens are out there[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top