c_str [C++ Reference]
Keywords: string,c_str
Date: 2009-12-12T06:07:49-0800

[[c_str]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## c_str

Syntax:

        #include <string>
        const char* c_str() const;

The function c_str() returns a const pointer to a regular C string, identical to the current string. The returned string is null-terminated.

Note that since the returned pointer is of type const, the character data that c_str() returns cannot be modified. Furthermore, you do not need to call free or delete on this pointer.

Related Topics: String operators, data

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •