Click here to Skip to main content
15,911,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: help with code error C2059:?? Pin
David Crow21-Feb-08 10:42
David Crow21-Feb-08 10:42 
GeneralRe: help with code error C2059:?? Pin
Maxwell Chen21-Feb-08 22:55
Maxwell Chen21-Feb-08 22:55 
GeneralLnk file path Pin
john563221-Feb-08 2:25
john563221-Feb-08 2:25 
QuestionPowerpoint Activex Pin
Soumyadipta21-Feb-08 2:01
Soumyadipta21-Feb-08 2:01 
GeneralRe: Powerpoint Activex Pin
Matthew Faithfull21-Feb-08 2:36
Matthew Faithfull21-Feb-08 2:36 
Generalcommon id in GUI Pin
guru moorthy.k21-Feb-08 1:44
guru moorthy.k21-Feb-08 1:44 
QuestionRe: common id in GUI Pin
Rajkumar R21-Feb-08 2:40
Rajkumar R21-Feb-08 2:40 
QuestionStuck up with NULL character Pin
abhijitr21-Feb-08 1:26
abhijitr21-Feb-08 1:26 
Hi,

I have written a class as follows:

class A
{
char str[2];
public:

A (LPSTR Astr)
{
strcpy(str, Astr);
}

A& operator = (LPSTR Astr)
{
strcpy(str, Astr);
return *this;
}
};

I have created a variable of the class and trying to assign it some values using following code

A a1("aa");

and returning this variable from a function.
This is failing with the following error message
"Run_Time Check Failure#2 - Stack around the variable 'a1' was corrupted" when I do this in a MFC application. This is right since I am not leaving any space for the null character.

However when I am doing the same thing in the DLL, it is running perfectly. I am not getting why it is running in DLL and failing in direct Application?

Can anybody please explain?
GeneralRe: Stuck up with NULL character Pin
CPallini21-Feb-08 2:16
mveCPallini21-Feb-08 2:16 
GeneralRe: Stuck up with NULL character Pin
David Crow21-Feb-08 3:40
David Crow21-Feb-08 3:40 
GeneralRe: Stuck up with NULL character Pin
Member 75496021-Feb-08 4:54
Member 75496021-Feb-08 4:54 
GeneralRe: Stuck up with NULL character Pin
David Crow21-Feb-08 6:36
David Crow21-Feb-08 6:36 
GeneralRe: Stuck up with NULL character Pin
Member 75496021-Feb-08 7:34
Member 75496021-Feb-08 7:34 
GeneralRe: Stuck up with NULL character Pin
James R. Twine21-Feb-08 8:29
James R. Twine21-Feb-08 8:29 
GeneralRe: Stuck up with NULL character Pin
Member 75496021-Feb-08 8:53
Member 75496021-Feb-08 8:53 
GeneralRe: Stuck up with NULL character Pin
Ali Rafiee21-Feb-08 9:53
Ali Rafiee21-Feb-08 9:53 
GeneralRe: Stuck up with NULL character Pin
abhijitr21-Feb-08 23:12
abhijitr21-Feb-08 23:12 
AnswerRe: Stuck up with NULL character Pin
abhijitr22-Feb-08 3:30
abhijitr22-Feb-08 3:30 
GeneralRe: Stuck up with NULL character Pin
Ali Rafiee22-Feb-08 5:10
Ali Rafiee22-Feb-08 5:10 
GeneralRe: Stuck up with NULL character Pin
abhijitr27-Feb-08 21:35
abhijitr27-Feb-08 21:35 
GeneralAbout polymorphism.. Pin
rowdy_vc++20-Feb-08 23:22
rowdy_vc++20-Feb-08 23:22 
GeneralRe: About polymorphism.. [modified] PinPopular
CPallini20-Feb-08 23:47
mveCPallini20-Feb-08 23:47 
GeneralRe: About polymorphism.. Pin
Rajkumar R21-Feb-08 0:03
Rajkumar R21-Feb-08 0:03 
GeneralRe: About polymorphism.. Pin
rowdy_vc++21-Feb-08 0:47
rowdy_vc++21-Feb-08 0:47 
GeneralRe: About polymorphism.. Pin
Rajkumar R21-Feb-08 1:02
Rajkumar R21-Feb-08 1:02 

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.