1 reply
by cam1
What compiler/libraries are you using? (16-bit? SDK ? MSVisual? Win32? Borland?) Most have an example with them to use the Win32 API or whatever. First you have to open/create a handle to the file. Then you have to use the handle to read it in to whatever memory space (buffer) if that's what you want to do. You can use CreateFile or Openfile (if you want to compatible with an older 16-bit platform). Here's an example of how to create a handle to the file you want to manipulate.
HANDLE hFileHandle ;
hFileHandle = CreateFile( "c:\\FileName.dat", //path to file with it's name
GENERIC_READ | GENERIC_WRITE, //we want to read and write to this file
0, //share?...comm devices which must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // file is aleady there, can create etc
FILE_ATTRIBUTE_NORMAL, // not overlapped I/O
NULL // hTemplate where you only want people to read it
);
Then you have to use ReadFile() to read it to wherever you want to. Let me know and I'll point you to a snippet you can use. why reinvent the wheel, eh?
C
This discussion is closed to new replies.
Trending IT Employment posts
Sort by Trending