'\0' in a C++ string?
From: Ray Mitchell (RayMitchell_at_MeanOldTeacher.com)
Date: 05/31/04
- Next message: Shiva: "===Welcome to comp.lang.c++! Read this first."
- Previous message: Shri: "Pragma Document"
- Next in thread: Jacques Labuschagne: "Re: '\0' in a C++ string?"
- Reply: Jacques Labuschagne: "Re: '\0' in a C++ string?"
- Reply: Rolf Magnus: "Re: '\0' in a C++ string?"
- Reply: Daniel T.: "Re: '\0' in a C++ string?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 31 May 2004 04:28:36 GMT
Hello,
My understanding is that C++ string class objects still terminate their
strings with a '\0', as do strings in C. If this is the case (please tell
me if it isn't), it appears that the easiest way to treat a C++ string as a
char * so it can be used with functions requiring a character pointer such
as strcmp (I realize that one would not normally want to do this), etc. is
to use the form: &stringObject[0] (is there a better way?). In MFC, one
need to merely cast the CString type to a char *, but this doesn't appear to
be the case with a standard C++ string.
Thanks,
Ray Mitchell
- Next message: Shiva: "===Welcome to comp.lang.c++! Read this first."
- Previous message: Shri: "Pragma Document"
- Next in thread: Jacques Labuschagne: "Re: '\0' in a C++ string?"
- Reply: Jacques Labuschagne: "Re: '\0' in a C++ string?"
- Reply: Rolf Magnus: "Re: '\0' in a C++ string?"
- Reply: Daniel T.: "Re: '\0' in a C++ string?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|