Click here to Skip to main content
15,908,264 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 8:33
professionalJoe Woodbury12-Jan-04 8:33 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 8:51
DruOfGov12-Jan-04 8:51 
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 10:02
professionalJoe Woodbury12-Jan-04 10:02 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 10:14
DruOfGov12-Jan-04 10:14 
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 10:34
professionalJoe Woodbury12-Jan-04 10:34 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 10:38
DruOfGov12-Jan-04 10:38 
GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 10:41
DruOfGov12-Jan-04 10:41 
GeneralRe: Problem Deleting Pointer Pin
Joe Woodbury12-Jan-04 12:01
professionalJoe Woodbury12-Jan-04 12:01 
The problem is that you are overrunning the buffer in your last for loop.

Even if you were handling the image correctly, which you are not, the correct for statement should be:

for( imageIdx = 0; imageIdx < bitmapInfoHeader->biSizeImage - 2; imageIdx += 3 )

(Note the "-2", in the loop you read/write "imageIdx + 2")

A bigger problem is all rows in a bitmap are aligned to a DWORD boundary. You algorithm will fail if ((width * 3) % 4 != 0)

The loop fails because there are padded bytes which means that biSizeImage is not divisable by three.

Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke

GeneralRe: Problem Deleting Pointer Pin
DruOfGov12-Jan-04 16:12
DruOfGov12-Jan-04 16:12 
GeneralRecompiling only modified files in vc++ environment Pin
haritadala12-Jan-04 7:53
haritadala12-Jan-04 7:53 
GeneralRe: Recompiling only modified files in vc++ environment Pin
Michael Dunn12-Jan-04 7:57
sitebuilderMichael Dunn12-Jan-04 7:57 
GeneralGateWay IP address Pin
gfds12-Jan-04 7:37
gfds12-Jan-04 7:37 
GeneralRe: GateWay IP address Pin
Jijo.Raj12-Jan-04 8:04
Jijo.Raj12-Jan-04 8:04 
Questionhow to open a closed output file(.CSV ) Pin
mr200312-Jan-04 7:32
mr200312-Jan-04 7:32 
AnswerRe: how to open a closed output file(.CSV ) Pin
Jijo.Raj12-Jan-04 7:51
Jijo.Raj12-Jan-04 7:51 
GeneralClosing all browser windows Pin
Vermithrax12-Jan-04 6:45
Vermithrax12-Jan-04 6:45 
GeneralRe: Closing all browser windows Pin
Ernesto D.12-Jan-04 11:51
Ernesto D.12-Jan-04 11:51 
GeneralRe: Closing all browser windows Pin
Vermithrax12-Jan-04 11:54
Vermithrax12-Jan-04 11:54 
Questionhow to write to a closed output file(.CSV) Pin
mr200312-Jan-04 6:32
mr200312-Jan-04 6:32 
AnswerRe: how to write to a closed output file(.CSV) Pin
Nick Hodapp12-Jan-04 6:39
sitebuilderNick Hodapp12-Jan-04 6:39 
GeneralRe: how to write to a closed output file(.CSV) Pin
mr200312-Jan-04 6:46
mr200312-Jan-04 6:46 
GeneralRe: how to write to a closed output file(.CSV) Pin
David Crow12-Jan-04 7:27
David Crow12-Jan-04 7:27 
GeneralRe: how to write to a closed output file(.CSV) Pin
Maximilien12-Jan-04 7:28
Maximilien12-Jan-04 7:28 
QuestionDouble to int? Pin
Hoornet9312-Jan-04 6:24
Hoornet9312-Jan-04 6:24 
AnswerRe: Double to int? Pin
Mike Player12-Jan-04 6:36
Mike Player12-Jan-04 6:36 

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.