Click here to Skip to main content
15,902,445 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionFlush a file after reading it? Pin
Lord Kixdemp26-Nov-05 22:21
Lord Kixdemp26-Nov-05 22:21 
AnswerRe: Flush a file after reading it? Pin
Johann Gerell26-Nov-05 23:38
Johann Gerell26-Nov-05 23:38 
QuestionRe: Flush a file after reading it? Pin
David Crow27-Nov-05 11:17
David Crow27-Nov-05 11:17 
AnswerRe: Flush a file after reading it? Pin
PJ Arends27-Nov-05 13:17
professionalPJ Arends27-Nov-05 13:17 
GeneralRe: Flush a file after reading it? Pin
Lord Kixdemp27-Nov-05 15:43
Lord Kixdemp27-Nov-05 15:43 
GeneralRe: Flush a file after reading it? Pin
Lord Kixdemp27-Nov-05 15:48
Lord Kixdemp27-Nov-05 15:48 
GeneralRe: Flush a file after reading it? Pin
Michael Dunn27-Nov-05 16:11
sitebuilderMichael Dunn27-Nov-05 16:11 
AnswerRe: Flush a file after reading it? Pin
Bob Stanneveld27-Nov-05 22:27
Bob Stanneveld27-Nov-05 22:27 
Hello,

The problem is that your buffer is too small. Just as Micheal Dunn pointed out: 1024^4 doesn't do what you want. operator ^ is the XOR operator. The result is: 1028.

You should try the following:
// read until there is nothing more to read:
char pcBuf[1024] = {0}; // buffer
DWORD dwBytesRead = 0;
while( !ReadFile(bipFile, pcBuffer, 1024, &dwBytesRead, NULL )
{
    if( dwBytesRead < 1024 )
        break; // end of the file found
    // do something with buffer
}

// do something with last bytes read in buffer


Hope this helps.

Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
AnswerRe: Flush a file after reading it? Pin
Michael Dunn27-Nov-05 16:15
sitebuilderMichael Dunn27-Nov-05 16:15 
GeneralRe: Flush a file after reading it? Pin
Lord Kixdemp28-Nov-05 13:55
Lord Kixdemp28-Nov-05 13:55 
GeneralRe: Flush a file after reading it? Pin
Michael Dunn16-Dec-05 10:22
sitebuilderMichael Dunn16-Dec-05 10:22 
GeneralRe: Flush a file after reading it? Pin
Lord Kixdemp16-Dec-05 10:37
Lord Kixdemp16-Dec-05 10:37 
GeneralRe: Flush a file after reading it? Pin
Michael Dunn16-Dec-05 10:52
sitebuilderMichael Dunn16-Dec-05 10:52 
GeneralRe: Flush a file after reading it? Pin
Lord Kixdemp16-Dec-05 12:53
Lord Kixdemp16-Dec-05 12:53 
QuestionCWebBrowser2::Navigate Pin
includeh1026-Nov-05 19:10
includeh1026-Nov-05 19:10 
AnswerRe: CWebBrowser2::Navigate Pin
Michael Dunn27-Nov-05 16:16
sitebuilderMichael Dunn27-Nov-05 16:16 
Questionwhat is the use of the CImageIterator Pin
blackeye200426-Nov-05 19:00
blackeye200426-Nov-05 19:00 
AnswerRe: what is the use of the CImageIterator Pin
Johann Gerell26-Nov-05 23:34
Johann Gerell26-Nov-05 23:34 
GeneralRe: what is the use of the CImageIterator Pin
blackeye200426-Nov-05 23:46
blackeye200426-Nov-05 23:46 
GeneralRe: what is the use of the CImageIterator Pin
Johann Gerell27-Nov-05 5:49
Johann Gerell27-Nov-05 5:49 
GeneralRe: what is the use of the CImageIterator Pin
blackeye200427-Nov-05 14:56
blackeye200427-Nov-05 14:56 
Questionerror LNK2001: unresolved external symbol Pin
Chintoo72326-Nov-05 18:03
Chintoo72326-Nov-05 18:03 
AnswerRe: error LNK2001: unresolved external symbol Pin
Garth J Lancaster26-Nov-05 18:39
professionalGarth J Lancaster26-Nov-05 18:39 
Questionhow to check if a local link exists? Pin
includeh1026-Nov-05 17:53
includeh1026-Nov-05 17:53 
AnswerRe: how to check if a local link exists? Pin
Chintoo72327-Nov-05 1:20
Chintoo72327-Nov-05 1:20 

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.