View previous topic :: View next topic |
Author |
Message |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Sun Feb 13, 2011 8:02 pm Post subject: how to use Overlapped field of WriteFile? |
|
|
//This two funcitons can be used to append data to end of the file.
Code: |
SetFilePointer(datafile, 0, 0, FILE_END);
WriteFile(datafile,text, strlen(text), &dwBytesWritten, 0);
|
how can we use the last field "Overlapped" of WriteFile to achieve the same functions as above?
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Feb 13, 2011 8:23 pm Post subject: |
|
|
The file handle has to have FILE_FLAG_OVERLAPPED permissions in order to even use the overlapped field. Once you have a proper handle, you can fill the overlapped structures members 'Offset' and 'OffsetHigh' to 0xFFFFFFFF in order to write to the end of the file.
_________________
- Retired. |
|
Back to top |
|
 |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Feb 14, 2011 7:39 am Post subject: |
|
|
i also found that stuff in msdn..
but was unable to figure it out.. how??
can you give some code explanation..
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Feb 14, 2011 1:35 pm Post subject: |
|
|
Not really sure what you don't understand, it's fairly straight forward.
WriteFile's first param is a handle that has to have 'FILE_FLAG_OVERLAPPED' permissions.
The overlapped struct needs to have its 'Offset' and 'OffsetHigh' members set to 0xFFFFFFFF.
It's pretty straight forward, I'm not going to spoon feed you with code.
_________________
- Retired. |
|
Back to top |
|
 |
|