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.
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.
Last edited by freiza; 10-29-2011 at 05:18 PM.
The perhaps you should also read THIS
Offset and OffseHigh are explained HERE
Both of these references were taken from the writeup for WriteFile() ... I suggest that instead of reading to find quick answers, at this point you should be reading to learn... that is, read every word, follow the links, and actually study the topics.
I trust that when you get to ReadFile() you'll use this new strategy.
@CommonTater: I have already learnt ReadFile.
Before asking question to forum. I try my best to understand. But all the people are not same. Some are less intelligent and needs push to run.
And Msdn just tells "What" and not "How" and "Why"?
Btw I am happy that you are keeping track of my progress.
Thank You
Yes, well... MSDN is a reference source, a place to look up functions and see how they are used. You're going to have to learn to read them eventually, now is as good a time as any. (and by "read", I mean READ; every word, as many times as it takes to understand.) There is no better source of Windows API information than Microsoft's own documentation.
And FWIW... claiming stupid is not how you make points with your helpers.
MSDN is a reference source and a place to look up functions --> yes
But you cannot see how the functions are actually used. For ex:
This does not give me clue how to put all of these in Writefile's lpOverlapped parameter.Code:typedef struct _OVERLAPPED { ULONG_PTR Internal; ULONG_PTR InternalHigh; union { struct { DWORD Offset; DWORD OffsetHigh; }; PVOID Pointer; }; HANDLE hEvent; } OVERLAPPED, *LPOVERLAPPED;
And actually I don't understand how do you people learn it without seeing any examples.
Thank You
Well, first off... are you doing overlapped I/O? (as in specifying FILE_FLAG_OVERLAPPED)
If not, then just put NULL in there. If MSDN's documentation says it can be NULL or 0... then put NULL or 0 unless you are explicitly using that feature. Seriously... that's what they intended for you to do.
More detail on Synchronous vs Overlapped I/O is HERE
There are usage examples HERE
Where did I get this information? By following and reading links in the WriteFile() documentation. Now each of these sections will have their own set of references... follow them too!
For a clean start: File (and other) I/O is explained HERE and HERE... which I found by following links from the CreateFile() function.
How do we learn it? By studying the supplied documentation... Not just opening the page expecting to find copy and paste examples then glazing over when thery're not there... We read the text, ALL of it, as often as it takes to understand, we follow the references and we read ALL of them as well... Knowledge does not just drop out of the sky... you have to go get it.
Right now --this minute-- I have no utter idea how to use DirectShow ... but by the time I need to add it to a project, I will have read up on it on MSDN and elsewhere written small test programs to make sure I understand it and I will have my code planned out and ready to enter and test...
The real skill here is not typing C syntax... that's easy stuff. The real deal that makes or breaks a programmer is the ability to look stuff up when he or she needs it... If you can't cultivate this skill (especially with an API exceeding 20,000 function calls) you should give it up right now. None of us, not a single one of us, can even hope to remember all this stuff.
Last edited by CommonTater; 10-30-2011 at 08:36 AM.