View Single Post
Old 21st November 2014, 01:14   #6  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by mariush View Post
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
Most of the APIs you mention like GetFileSizeEx() are not available in VC6.
Groucho2004 is offline   Reply With Quote