std::basic_string::c_str
De cppreference.com
< cpp | string | basic string
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
const CharT* c_str() const; |
||
Devuelve un puntero a una matriz de caracteres terminada en nulo con los datos equivalentes a los que están almacenados en la cadena. El puntero es tal que el
[c_str(); c_str() + size()]
rango es válida y los valores que corresponden a los valores almacenados en la cadena con un carácter nulo adicional después de la última posición .Original:
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 text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Contenido |
[editar] Notas
El puntero obtenido de
c_str()
sólo se puede tratar como un puntero a una cadena de caracteres terminada en nulo si el objeto de cadena no contiene otros caracteres nulos .Original:
The pointer obtained from
c_str()
may only be treated as a pointer to a null-terminated character string if the string object does not contain other null characters.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
La escritura en la matriz de caracteres se accede a través
c_str()
es un comportamiento indefinido .Original:
Writing to the character array accessed through
c_str()
is undefined behavior.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Puesto que C + 11,
c_str()
y data()
realizar la misma función .Original:
Since C++11,
c_str()
and data()
perform the same function.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Parámetros
(Ninguno)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Valor de retorno
Puntero a la matriz de caracteres terminada en nulo tal que para cada data()[i] == operator[](i)
i
en [0, size()]
. (hasta C++11)Original:
Pointer to the null-terminated character array such that data()[i] == operator[](i) for every
i
in [0, size()]
. (hasta C++11)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Puntero al almacenamiento de caracteres subyacente, que data() + i == &operator[](i) para cada
i
en [0, size()]
. (desde C++11)Original:
Pointer to the underlying character storage such that data() + i == &operator[](i) for every
i
in [0, size()]
. (desde C++11)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Complejidad
Constante .
Original:
Constant.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Excepciones
[editar] Ver también
(C++11) |
accede al primer carácter Original: accesses the first character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (miembro público función) |
(C++11) |
accede al último carácter Original: accesses the last character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (miembro público función) |
devuelve un puntero al primer carácter de una cadena Original: returns a pointer to the first character of a string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (miembro público función) |