Click here to Skip to main content
16,011,743 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionnotification to parent Pin
Tarek Jabri12-Mar-06 5:07
Tarek Jabri12-Mar-06 5:07 
AnswerRe: notification to parent Pin
PJ Arends12-Mar-06 9:44
professionalPJ Arends12-Mar-06 9:44 
QuestionCBitmap Pin
BabyGuru12-Mar-06 5:00
BabyGuru12-Mar-06 5:00 
AnswerRe: CBitmap Pin
PJ Arends12-Mar-06 9:23
professionalPJ Arends12-Mar-06 9:23 
Questionwhat's the difference between data() and c_str() of basic_string? Pin
xjzhou12-Mar-06 4:29
xjzhou12-Mar-06 4:29 
AnswerRe: what's the difference between data() and c_str() of basic_string? Pin
Nemanja Trifunovic12-Mar-06 4:42
Nemanja Trifunovic12-Mar-06 4:42 
GeneralRe: what's the difference between data() and c_str() of basic_string? Pin
xjzhou12-Mar-06 5:01
xjzhou12-Mar-06 5:01 
GeneralRe: what's the difference between data() and c_str() of basic_string? Pin
Nemanja Trifunovic12-Mar-06 6:08
Nemanja Trifunovic12-Mar-06 6:08 
ustclover wrote:
when I view the memory, szTemp1 and szTemp2 have the same content,
and both of them end with '\0'.


Note the word "guaranteed". The C++ Standard requires c_str to return a pointer to an array that ends with `\0`, and it does not require (nor forbid, for that matter) for data.

The implementation you tested obviously returns a pointer to the same piece of memory in both cases, but it is not necessarily the case for all implementations.

Also, have you tested the case when you have an empty string? c_str() would be guaranteed to return the pointer to `\0`. For data(), again it is implementation dependent, but I would be surprised if it returned the same thing.






My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
GeneralRe: what's the difference between data() and c_str() of basic_string? Pin
xjzhou14-Mar-06 4:53
xjzhou14-Mar-06 4:53 
QuestionCBitmap Pin
mehrdadov12-Mar-06 4:21
mehrdadov12-Mar-06 4:21 
AnswerRe: CBitmap Pin
xjzhou12-Mar-06 5:07
xjzhou12-Mar-06 5:07 
Questionhow can i launch a programm before session openning Pin
ss200612-Mar-06 2:54
ss200612-Mar-06 2:54 
AnswerRe: how can i launch a programm before session openning Pin
Ryan Binns12-Mar-06 17:22
Ryan Binns12-Mar-06 17:22 
QuestionWindows Forms Linking - V C++.NET Pin
luhfluh12-Mar-06 1:56
luhfluh12-Mar-06 1:56 
AnswerRe: Windows Forms Linking - V C++.NET Pin
Hamid_RT12-Mar-06 3:08
Hamid_RT12-Mar-06 3:08 
GeneralRe: Windows Forms Linking - V C++.NET Pin
luhfluh12-Mar-06 4:03
luhfluh12-Mar-06 4:03 
QuestionFixed path for File Open/Save Dialog.... Pin
ibexcentral12-Mar-06 0:37
ibexcentral12-Mar-06 0:37 
AnswerRe: Fixed path for File Open/Save Dialog.... Pin
Stober12-Mar-06 0:52
Stober12-Mar-06 0:52 
AnswerRe: Fixed path for File Open/Save Dialog.... Pin
Gary R. Wheeler12-Mar-06 2:24
Gary R. Wheeler12-Mar-06 2:24 
QuestionGLUT main problem Pin
amanoullah11-Mar-06 22:36
amanoullah11-Mar-06 22:36 
AnswerRe: GLUT main problem Pin
Dominik Reichl12-Mar-06 1:36
Dominik Reichl12-Mar-06 1:36 
QuestionAdobe Distiller Pin
Dr-Kuulun11-Mar-06 22:06
Dr-Kuulun11-Mar-06 22:06 
AnswerRe: Adobe Distiller Pin
Dr-Kuulun11-Mar-06 22:10
Dr-Kuulun11-Mar-06 22:10 
GeneralRe: Adobe Distiller Pin
Hamid_RT12-Mar-06 2:53
Hamid_RT12-Mar-06 2:53 
QuestionGLUT problem Pin
amanoullah11-Mar-06 20:18
amanoullah11-Mar-06 20: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.