Click here to Skip to main content
15,894,540 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CComboBox Question Pin
David Crow16-Jun-05 10:57
David Crow16-Jun-05 10:57 
GeneralMFC Doc/View Pin
E Dyot16-Jun-05 10:12
E Dyot16-Jun-05 10:12 
GeneralRe: MFC Doc/View Pin
David Crow16-Jun-05 10:55
David Crow16-Jun-05 10:55 
GeneralRe: MFC Doc/View Pin
Member 142769216-Jun-05 13:49
Member 142769216-Jun-05 13:49 
GeneralXML Pin
LCI16-Jun-05 10:01
LCI16-Jun-05 10:01 
GeneralRe: XML Pin
ThatsAlok17-Jun-05 2:38
ThatsAlok17-Jun-05 2:38 
GeneralUsing readfile() Pin
Camron16-Jun-05 9:48
Camron16-Jun-05 9:48 
GeneralRe: Using readfile() Pin
krmed16-Jun-05 10:06
krmed16-Jun-05 10:06 
There are many problems with the code you posted... these parts are OK:

Camron wrote:
HANDLE fptr;
bool bResult;
DWORD nBytesToRead = 20;


But here are the problems...
LPVOID inBuffer; // declares a pointer to wherever you will store input, but no memory allocated for it.<br />
LPDWORD nBytesRead = 0; // declares a pointer to a DWORD to receive the number of bytes read, but no memory to store it.


These should be similar to the following:
<br />
UCHAR inBuffer[10000]; // or whatever size you want<br />
DWORD nBytesRead = 0; // we'll cast to a pointer later<br />

Now with those changes, there is one more step before you can read...

fptr is a handle to a file - you haven't opened a file yet!

Now your attempt to read would become:
bResult = ReadFile(fptr, inBuffer, nBytesToRead, &nBytesRead, NULL);

After you read, you can close the file.

Hope that helps.

Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
GeneralProblem Reading Excel (.xls) file into VC++ Pin
CodeGoose16-Jun-05 9:01
CodeGoose16-Jun-05 9:01 
GeneralRe: Problem Reading Excel (.xls) file into VC++ Pin
GogglesPisano16-Jun-05 10:07
GogglesPisano16-Jun-05 10:07 
Generalfile access Pin
bkphat16-Jun-05 8:56
bkphat16-Jun-05 8:56 
GeneralRe: file access Pin
David Crow16-Jun-05 9:31
David Crow16-Jun-05 9:31 
GeneralCode beautifier - Lazy programmer looking for ideas Pin
Vaclav16-Jun-05 8:40
Vaclav16-Jun-05 8:40 
GeneralRe: Code beautifier - Lazy programmer looking for ideas Pin
Blake Miller16-Jun-05 12:49
Blake Miller16-Jun-05 12:49 
GeneralProblems with Dialog Controls in VS2003 Pin
NTense16-Jun-05 8:35
NTense16-Jun-05 8:35 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
Wes Aday16-Jun-05 9:15
professionalWes Aday16-Jun-05 9:15 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
NTense16-Jun-05 10:50
NTense16-Jun-05 10:50 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
NTense16-Jun-05 10:55
NTense16-Jun-05 10:55 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
Wes Aday16-Jun-05 11:00
professionalWes Aday16-Jun-05 11:00 
GeneralWaitForSingleObject() help Pin
kani9816-Jun-05 8:33
kani9816-Jun-05 8:33 
GeneralRe: WaitForSingleObject() help Pin
Blake Miller16-Jun-05 12:58
Blake Miller16-Jun-05 12:58 
GeneralRe: WaitForSingleObject() help Pin
Anonymous20-Jun-05 7:07
Anonymous20-Jun-05 7:07 
GeneralHowTo read/display version info Pin
Robert Palma Jr.16-Jun-05 8:26
Robert Palma Jr.16-Jun-05 8:26 
GeneralRe: HowTo read/display version info Pin
David Crow16-Jun-05 9:33
David Crow16-Jun-05 9:33 
GeneralRe: HowTo read/display version info Pin
Robert Palma Jr.17-Jun-05 5:49
Robert Palma Jr.17-Jun-05 5:49 

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.