The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: UPucker on December 15, 2005, 11:02:25 AM

Title: File editing
Post by: UPucker on December 15, 2005, 11:02:25 AM
OK heres the problem. I want to open a file, read from a specific location in the file, then modify the data at that location, and write it back to the file. The file can be quite large(8mb). Can someone point me in the right direction, or simply post an example?

thanks in advance.

Title: Re: File editing
Post by: Tedd on December 15, 2005, 12:05:38 PM
CreateFile..... GENERIC_READ or GENERIC_WRITE...
SetFilePointer
ReadFile
SetFilePointer
WriteFile
CloseHandle


PS Patching files is a grey area for legality :8)
Title: Re: File editing
Post by: sluggy on December 15, 2005, 11:31:06 PM
What sort of file is it?
Title: Re: File editing
Post by: hutch-- on December 15, 2005, 11:39:20 PM
It sounds something like reading records in a large database file. Let us know how the file is layed out as there are some very good techniques if the data is regular.
Title: Re: File editing
Post by: UPucker on December 16, 2005, 11:46:51 AM
thanks for the replies. I figured it out using...
invoke createfile, invoke readfile, and invoke writefile