Click here to Skip to main content
15,918,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Overwrite avoiding in memcpy Pin
CPallini4-Jan-08 0:00
mveCPallini4-Jan-08 0:00 
GeneralRe: Overwrite avoiding in memcpy Pin
Maxwell Chen4-Jan-08 0:12
Maxwell Chen4-Jan-08 0:12 
GeneralRe: Overwrite avoiding in memcpy Pin
CPallini4-Jan-08 0:25
mveCPallini4-Jan-08 0:25 
GeneralRe: Overwrite avoiding in memcpy Pin
Maxwell Chen4-Jan-08 0:40
Maxwell Chen4-Jan-08 0:40 
GeneralRe: Overwrite avoiding in memcpy Pin
CodingLover3-Jan-08 20:41
CodingLover3-Jan-08 20:41 
GeneralRe: Overwrite avoiding in memcpy Pin
Maxwell Chen3-Jan-08 20:42
Maxwell Chen3-Jan-08 20:42 
GeneralRe: Overwrite avoiding in memcpy Pin
Haroon Sarwar3-Jan-08 20:46
Haroon Sarwar3-Jan-08 20:46 
GeneralRe: Overwrite avoiding in memcpy Pin
David Crow4-Jan-08 3:15
David Crow4-Jan-08 3:15 
Eranga Thennakoon wrote:
::memcpy(tmpBuffer, &iReq, 4);
::memcpy(tmpBuffer, &strGetName, 6);


These two statements are writing to the same location. The second one needs to write four bytes past the starting address of tmpBuffer, like.

// complexities left to reader
memcpy(tmpBuffer, &iReq, 4);
memcpy(tmpBuffer+4, strGetName, 6);


"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne


GeneralRe: Overwrite avoiding in memcpy Pin
CodingLover6-Jan-08 17:04
CodingLover6-Jan-08 17:04 
GeneralRe: Overwrite avoiding in memcpy Pin
David Crow7-Jan-08 3:10
David Crow7-Jan-08 3:10 
GeneralC2144 error char should be preceded by ; Pin
subramanyeswari3-Jan-08 18:39
subramanyeswari3-Jan-08 18:39 
GeneralRe: C2144 error char should be preceded by ; Pin
Haroon Sarwar3-Jan-08 19:18
Haroon Sarwar3-Jan-08 19:18 
GeneralRe: C2144 error char should be preceded by ; Pin
subramanyeswari3-Jan-08 19:26
subramanyeswari3-Jan-08 19:26 
GeneralRe: C2144 error char should be preceded by ; Pin
Haroon Sarwar3-Jan-08 19:34
Haroon Sarwar3-Jan-08 19:34 
GeneralRe: C2144 error char should be preceded by ; Pin
subramanyeswari3-Jan-08 19:39
subramanyeswari3-Jan-08 19:39 
GeneralRe: C2144 error char should be preceded by ; Pin
subramanyeswari3-Jan-08 19:41
subramanyeswari3-Jan-08 19:41 
GeneralRe: C2144 error char should be preceded by ; Pin
Haroon Sarwar3-Jan-08 19:47
Haroon Sarwar3-Jan-08 19:47 
GeneralRe: C2144 error char should be preceded by ; Pin
beko3-Jan-08 20:22
beko3-Jan-08 20:22 
GeneralRe: C2144 error char should be preceded by ; Pin
subramanyeswari3-Jan-08 22:07
subramanyeswari3-Jan-08 22:07 
GeneralRe: C2144 error char should be preceded by ; Pin
Iain Clarke, Warrior Programmer3-Jan-08 23:28
Iain Clarke, Warrior Programmer3-Jan-08 23:28 
GeneralRe: C2144 error char should be preceded by ; Pin
subramanyeswari4-Jan-08 0:06
subramanyeswari4-Jan-08 0:06 
QuestionList control with "horizontal header" ? Pin
Vaclav_3-Jan-08 15:54
Vaclav_3-Jan-08 15:54 
AnswerRe: List control with "horizontal header" ? Pin
David Crow3-Jan-08 16:06
David Crow3-Jan-08 16:06 
QuestionRe: List control with "horizontal header" ? Pin
Maxwell Chen3-Jan-08 16:08
Maxwell Chen3-Jan-08 16:08 
GeneralRe: List control with "horizontal header" ? Pin
Vaclav_3-Jan-08 16:18
Vaclav_3-Jan-08 16:18 

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.