Click here to Skip to main content
16,006,535 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multicast .... Pin
Mike Nordell23-Sep-02 8:24
Mike Nordell23-Sep-02 8:24 
GeneralRe: Multicast .... Pin
User 988523-Sep-02 8:33
User 988523-Sep-02 8:33 
GeneralTrouble reading files...CFile:Read Pin
merc23-Sep-02 5:00
merc23-Sep-02 5:00 
GeneralRe: Trouble reading files...CFile:Read Pin
jmkhael23-Sep-02 5:32
jmkhael23-Sep-02 5:32 
GeneralRe: Trouble reading files...CFile:Read Pin
merc23-Sep-02 6:34
merc23-Sep-02 6:34 
GeneralRe: Trouble reading files...CFile:Read Pin
jmkhael23-Sep-02 7:09
jmkhael23-Sep-02 7:09 
GeneralRe: Trouble reading files...CFile:Read Pin
Neville Franks23-Sep-02 5:37
Neville Franks23-Sep-02 5:37 
GeneralRe: Trouble reading files...CFile:Read Pin
merc23-Sep-02 6:38
merc23-Sep-02 6:38 
Hi,

You're right. The number of bytes returned from reading is ZERO before end of file has been reached.
When I check the pBuf, it has loaded "" into it..more likely, it loads nothing in the buffer. That's why it returns ZERO bytes. But this works for text/wri files though.

void MyClass::Read(CString sFilename)
{
BYTE *pBuf = new BYTE[4096];
CFile pFile (sFilename, CFile::modeRead); //tried
//CFile::typeBinary too
int iReadSize = 0;
while(true){
iReadSize = pFile.Read(pBuf, 4096);
if(iReadSize == 0)
break;
else{
//my processing goes here
}
}
pFile.Close();
}

Your thoughts on this will be very appreciated.
JJ
GeneralRe: Trouble reading files...CFile:Read Pin
Neville Franks23-Sep-02 11:47
Neville Franks23-Sep-02 11:47 
GeneralRe: Trouble reading files...CFile:Read Pin
merc24-Sep-02 7:27
merc24-Sep-02 7:27 
GeneralRe: Trouble reading files...CFile:Read Pin
Todd Smith23-Sep-02 6:18
Todd Smith23-Sep-02 6:18 
GeneralRe: Trouble reading files...CFile:Read Pin
merc23-Sep-02 6:40
merc23-Sep-02 6:40 
Generaladding chm help file to project Pin
Hel23-Sep-02 4:53
Hel23-Sep-02 4:53 
GeneralRe: adding chm help file to project Pin
Pavel Klocek23-Sep-02 5:23
Pavel Klocek23-Sep-02 5:23 
GeneralRe: adding chm help file to project Pin
Hel23-Sep-02 5:27
Hel23-Sep-02 5:27 
GeneralRe: adding chm help file to project: File missing at link Pin
ns23-Sep-02 5:46
ns23-Sep-02 5:46 
GeneralRe: adding chm help file to project: File missing at link Pin
Hel23-Sep-02 6:32
Hel23-Sep-02 6:32 
GeneralRe: adding chm help file to project: File missing at link Pin
Pavel Klocek23-Sep-02 8:48
Pavel Klocek23-Sep-02 8:48 
GeneralRe: adding chm help file to project: File missing at link Pin
ns23-Sep-02 9:53
ns23-Sep-02 9:53 
Generalcreate Browse For Folder dialog box Pin
tomc23-Sep-02 4:38
tomc23-Sep-02 4:38 
GeneralRe: create Browse For Folder dialog box Pin
Bing Ding23-Sep-02 4:42
Bing Ding23-Sep-02 4:42 
GeneralRe: create Browse For Folder dialog box Pin
Pavel Klocek23-Sep-02 5:32
Pavel Klocek23-Sep-02 5:32 
GeneralEnabling password complexity in win2k programmatically Pin
abhinarulkar23-Sep-02 4:37
abhinarulkar23-Sep-02 4:37 
GeneralStatic libraries Pin
Zizilamoroso23-Sep-02 4:00
Zizilamoroso23-Sep-02 4:00 
GeneralRe: Static libraries Pin
jhwurmbach23-Sep-02 4:24
jhwurmbach23-Sep-02 4:24 

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.