View Single Post
Old 21st November 2014, 01:10   #5  |  Link
mariush
Registered User
 
Join Date: Dec 2008
Posts: 589
Open the file using CreateFile (windows api function) : http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx (note, there's also CreateFile2 but it's not required for your particular needs)

CreateFile can create files or open existing files, it all depends on the parameters you pass to it. Read documentation at link above.

Use GetFileSizeEx to get the 64 bit file size : http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

Use SetFilePointerEx to position yourself in the file... http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
As the documentation says, you can also use this function to determine where you are in the file [ex setfilepointerex( filehandle, 0, variable_for_current_position, file_current) ] or to determine the file size by saying setfilepointerex(filehandle,0,variable,file_end) but then you'd have to reset the point to read from beginning.


There's also GetFileInformationByHandle function that could be useful... you need to pass a structure to it and it populates that with info based on a file handle you give it. See http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
mariush is offline   Reply With Quote