String.c_str()
Description
Converts the contents of a String as a C-style, null-terminated string. Note that this gives direct access to the internal String buffer and should be used with care. In particular, you should never modify the string through the pointer returned. When you modify the String object, or when it is destroyed, any pointer previously returned by c_str() becomes invalid and should not be used any longer.
Syntax
myString.c_str()
Parameter Values
- myString: a variable of type String.
Return Values
- A pointer to the C-style version of the invoking String.
※ NOTES AND WARNINGS:
If the string is modified, it is highly recommended using String.reserve() to prevent the memory fragmentation issue
See Also
- Language : Arduino - String
- Language : String.charAt()
- Language : String.compareTo()
- Language : String.concat()
- Language : String.endsWith()
- Language : String.equals()
- Language : String.equalsIgnoreCase()
- Language : String.getBytes()
- Language : String.indexOf()
- Language : String.lastIndexOf()
- Language : String.length()
- Language : String.remove()
- Language : String.replace()
- Language : String.reserve()
- Language : String.setCharAt()
- Language : String.startsWith()
- Language : String.substring()
- Language : String.toCharArray()
- Language : String.toDouble()
- Language : String.toFloat()
- Language : String.toInt()
- Language : String.toLowerCase()
- Language : String.toUpperCase()
- Language : String.trim()
- Example : String Tutorials
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |