Click here to Skip to main content
15,899,935 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNeed to help in file reading in win32 Pin
amitmistry_petlad 17-Jan-07 23:54
amitmistry_petlad 17-Jan-07 23:54 
AnswerRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 0:23
Roger Stoltz18-Jan-07 0:23 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 0:30
amitmistry_petlad 18-Jan-07 0:30 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 0:41
Roger Stoltz18-Jan-07 0:41 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 1:10
amitmistry_petlad 18-Jan-07 1:10 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 2:05
Roger Stoltz18-Jan-07 2:05 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 16:36
amitmistry_petlad 18-Jan-07 16:36 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 21:19
Roger Stoltz18-Jan-07 21:19 
Instead of making assumptions about my memory, you should get your datatypes straight.

The things you claim to be DWORD is never DWORD in the code you've posted.
You declare szBuff as an array of WCHAR and WCHAR is a typedef that can be either 8 or 16 bits wide, but never 32 as a DWORD. In your configuration it's 16 bits wide since you've enabled support for unicode.
The only thing about szBuff that is 32 bits wide is its address you provide as argument in the call to ReadFile, but do not mix up an address with a 32 bit integer value.

ReadFile read the contents of a file in raw format, i.e. byte-wise, and puts it at a memory location you provide as argument, szBuff in your case. If the format of the data read doesn't fit your needs, convert it! In this case by calling MultiByteToWideChar providing the buffer with the data read as input and a pointer to a new location where you want the resulting data to be stored.
Bring up the memory debug window and have a look at your <codes>zBuff. After a successful call to ReadFile you will see the contents of your file there.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote

GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 0:41
amitmistry_petlad 18-Jan-07 0:41 
Questionheap or stack? Pin
himuskanhere17-Jan-07 23:30
himuskanhere17-Jan-07 23:30 
AnswerRe: heap or stack? Pin
toxcct17-Jan-07 23:46
toxcct17-Jan-07 23:46 
AnswerRe: heap or stack? Pin
Roger Stoltz17-Jan-07 23:51
Roger Stoltz17-Jan-07 23:51 
AnswerRe: heap or stack? Pin
James R. Twine18-Jan-07 6:08
James R. Twine18-Jan-07 6:08 
GeneralRe: heap or stack? Pin
Mark Salsbery18-Jan-07 6:36
Mark Salsbery18-Jan-07 6:36 
GeneralRe: heap or stack? Pin
James R. Twine18-Jan-07 8:27
James R. Twine18-Jan-07 8:27 
GeneralRe: heap or stack? Pin
Mark Salsbery18-Jan-07 8:41
Mark Salsbery18-Jan-07 8:41 
QuestionKey Events Pin
baerten17-Jan-07 23:24
baerten17-Jan-07 23:24 
AnswerRe: Key Events Pin
malaugh18-Jan-07 7:09
malaugh18-Jan-07 7:09 
GeneralRe: Key Events Pin
baerten18-Jan-07 21:27
baerten18-Jan-07 21:27 
QuestionHow to set the position of the blinking text cursor in a CEdit box. Pin
whatever@whatever.com17-Jan-07 23:12
whatever@whatever.com17-Jan-07 23:12 
AnswerRe: How to set the position of the blinking text cursor in a CEdit box. Pin
prasad_som17-Jan-07 23:19
prasad_som17-Jan-07 23:19 
GeneralRe: How to set the position of the blinking text cursor in a CEdit box. Pin
James R. Twine18-Jan-07 6:10
James R. Twine18-Jan-07 6:10 
GeneralRe: How to set the position of the blinking text cursor in a CEdit box. Pin
whatever@whatever.com18-Jan-07 14:01
whatever@whatever.com18-Jan-07 14:01 
AnswerRe: How to set the position of the blinking text cursor in a CEdit box. Pin
Rajasekharan Vengalil17-Jan-07 23:57
Rajasekharan Vengalil17-Jan-07 23:57 
GeneralRe: How to set the position of the blinking text cursor in a CEdit box. Pin
whatever@whatever.com18-Jan-07 14:00
whatever@whatever.com18-Jan-07 14:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.