Click here to Skip to main content
15,900,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: double to CString and back Pin
Naveen19-Jul-06 0:48
Naveen19-Jul-06 0:48 
AnswerRe: double to CString and back Pin
Ștefan-Mihai MOGA19-Jul-06 0:50
professionalȘtefan-Mihai MOGA19-Jul-06 0:50 
AnswerRe: double to CString and back Pin
Hamid_RT19-Jul-06 2:37
Hamid_RT19-Jul-06 2:37 
GeneralRe: double to CString and back Pin
Desmo1619-Jul-06 3:39
Desmo1619-Jul-06 3:39 
GeneralRe: double to CString and back [modified] Pin
toxcct19-Jul-06 3:40
toxcct19-Jul-06 3:40 
GeneralRe: double to CString and back Pin
Zac Howland19-Jul-06 4:32
Zac Howland19-Jul-06 4:32 
GeneralRe: double to CString and back Pin
toxcct19-Jul-06 4:46
toxcct19-Jul-06 4:46 
GeneralRe: double to CString and back [modified] Pin
Zac Howland19-Jul-06 4:55
Zac Howland19-Jul-06 4:55 
toxcct wrote:
char name2;
strcpy(name2, str);


That still won't compile. You'd have to write it like so:

char name2;
strcpy(&name2, str);


Which is VERY BAD. Since strcpy doesn't check for proper lengths on the source array, it will just start writing to memory at the address (which is the address of a single character) and keep going until its done. That is, it will overwrite at least 1 character in memory that is not allocated for name2 if str is anything but an empty string. I believe what you wanted to show was:

char name2[30] = {0};
strcpy(name2, str);



If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

-- modified at 10:56 Wednesday 19th July, 2006
GeneralRe: double to CString and back Pin
toxcct19-Jul-06 5:00
toxcct19-Jul-06 5:00 
QuestionGDI+ and Zooming on the picture ... Pin
Hadi Rezaee19-Jul-06 0:22
Hadi Rezaee19-Jul-06 0:22 
QuestionFinding if the target platform supports 64 bit Arithmetic Pin
ComplexLifeForm19-Jul-06 0:19
ComplexLifeForm19-Jul-06 0:19 
AnswerRe: Finding if the target platform supports 64 bit Arithmetic Pin
Steve S19-Jul-06 1:39
Steve S19-Jul-06 1:39 
AnswerRe: Finding if the target platform supports 64 bit Arithmetic Pin
Chris Losinger19-Jul-06 1:41
professionalChris Losinger19-Jul-06 1:41 
Questionvs c++ Pin
jitenderbansal18-Jul-06 23:54
jitenderbansal18-Jul-06 23:54 
AnswerRe: vs c++ Pin
toxcct18-Jul-06 23:56
toxcct18-Jul-06 23:56 
GeneralRe: vs c++ Pin
see me19-Jul-06 0:07
see me19-Jul-06 0:07 
GeneralRe: vs c++ Pin
toxcct19-Jul-06 0:11
toxcct19-Jul-06 0:11 
GeneralRe: vs c++ Pin
see me19-Jul-06 0:22
see me19-Jul-06 0:22 
GeneralRe: vs c++ Pin
toxcct19-Jul-06 0:24
toxcct19-Jul-06 0:24 
GeneralRe: vs c++ Pin
see me19-Jul-06 0:34
see me19-Jul-06 0:34 
GeneralRe: vs c++ Pin
see me19-Jul-06 0:23
see me19-Jul-06 0:23 
AnswerRe: vs c++ Pin
sunit519-Jul-06 0:01
sunit519-Jul-06 0:01 
AnswerRe: vs c++ Pin
_AnsHUMAN_ 19-Jul-06 0:21
_AnsHUMAN_ 19-Jul-06 0:21 
GeneralRe: vs c++ Pin
see me19-Jul-06 0:31
see me19-Jul-06 0:31 
AnswerRe: vs c++ Pin
Ștefan-Mihai MOGA19-Jul-06 0:35
professionalȘtefan-Mihai MOGA19-Jul-06 0:35 

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.