On Apr 21, 4:57 am, "Ivan Vecerina"
<_INVALID_use_webfo...@ivan.vecerina.comwrote:
"Mark P" <use...@fall2005REMOVE.fastmailCAPS.fmwrote in message
news:cB****************@newssvr17.news.prodigy.net ...: mike7...@gmail.comwrote:
: When you use she STL string class and the c_str() function, how does
: the memory returned by c_str() get allocated and destroyed?
: The memory is controlled by the string object
Yep.
: after the string is destructed
: you must not access the memory returned by c_str().
Not only destruction, but any operation that modifies
Any operation which permits modification, in fact. Calling [],
at(), begin() or end() on a non-const string, or through a
non-const reference to the string, may also invalidate the
pointer.
--
James Kanze (Gabi Software) email:
ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34