Namespaces
Variants
Actions

std::basic_string<CharT,Traits,Allocator>::c_str

From cppreference.com
< cpp‎ | string‎ | basic string
 
 
 
std::basic_string
 
const CharT* c_str() const;
(noexcept since C++11)
(constexpr since C++20)

Returns a pointer to a null-terminated character array with data equivalent to those stored in the string.

The pointer is such that the range [c_str()c_str() + size()] is valid and the values in it correspond to the values stored in the string with an additional null character after the last position.

The pointer obtained from c_str() may be invalidated by:

Writing to the character array accessed through c_str() is undefined behavior.

c_str() and data() perform the same function.

(since C++11)

Contents

[edit] Parameters

(none)

[