Jump to content

What is lpOverlapped?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
freiza

freiza

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
Q) What is the last parameter of Writefile (lpOverlapped)? What is it. And why it should be set to null. (I tried reading msdn. But couldn't understand)
And how to use Offset and OffsetHigh member.

#2
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,254 posts
  • Location:C:\Countries\US
lpOverlapped is for asynchronous I/O, from what I understand. If you did not open the file for asynchronous reading/writing, you do not need to worry about that parameter.

I like things to be in order, and mostly don't care about asynchronous operations, so I use 0 for that parameter; though because of that, I don't know much about it either. I just know that it's for asynchronous I/O. Though the offset fields are probably used for file offsets.

A file offset is kind of like a pointer, or an address, of where to read from or write to within the file. Since files can be greater than 4 GB, however, you can't access data that's beyond 4 GB in the file using just a 32-bit Offset parameter; that's why there's also OffsetHigh.

At least from what I understand, the absolute address of the data, relative to the beginning of the file, = OffsetHigh * 2^32 + Offset

Note: By 2^32, I mean "two to the thirty-second power" , as in mathematics, not "two exclusive or thirty-two" , as in a computer language.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users