GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing cplusplus.com — std::string::data Reference
string
public member function
<string>
std::string::dataconst char* data() const; const char* data() const noexcept; Get string data
Returns a pointer to an array that contains the same sequence of characters as the characters that make up the value of the string object.
Accessing the value at data()+size() produces undefined behavior: There are no guarantees that a null character terminates the character sequence pointed by the value returned by this function. See string::c_str for a function that provides such guarantee. A program shall not alter any of the characters in this sequence.
Returns a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the string object.
This array includes the same sequence of characters that make up the value of the string object plus an additional terminating null-character ('\0') at the end. The pointer returned points to the internal array currently used by the string object to store the characters that conform its value. Both string::data and string::c_str are synonyms and return the same value. The pointer returned may be invalidated by further calls to other member functions that modify the object. ParametersnoneReturn ValueA pointer to the c-string representation of the string object's value.Example
Output:
Complexity, iterator, access, exceptionsUnspecified or contradictory specifications.ComplexityConstant.Iterator validityNo changes.Data racesThe object is accessed.Exception safetyNo-throw guarantee: this member function never throws exceptions.See also
Home page | Privacy policy
© cplusplus.com, 2000-2026 - All rights reserved - v3.3.4s Spotted an error? contact us | |||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |