Horje
string to char* Code Example
convert string to char c++
// "std::string" has a method called "c_str()" that returns a "const char*"
// pointer to its inner memory. You can copy that "const char*" to a variable
// using "strcpy()".

std::string str = "Hello World";
char buffer[50];

strcpy(buffer, str.c_str());

std::cout << buffer;	//Output: Hello World

//POSTED BY eferion ON STACK OVERFLOW (IN SPANISH).
string to char


std::string str = "string";
const char *cstr = str.c_str();


string to char*
std::string str = "string";
const char *cstr = str.c_str();
java convert a string to char[]
String string =  "ABCDEF" ;
 
char[] charsFromString = string.toCharArray(); // { 'A', 'B', 'C', 'D', 'E', 'F' }
string to char in java
// getting single character from string..
String str="abcd";

char c=str.toChar(0); 

System.out.println("output is "+c); // output is a
string to char
string temp = "cat";
char * tab2 = new char [temp.length()+1];
strcpy (tab2, temp.c_str());




Cpp

Related
delete last char of string C++ Code Example delete last char of string C++ Code Example
priority queue c++ type of pairs Code Example priority queue c++ type of pairs Code Example
cpp map iterate over keys Code Example cpp map iterate over keys Code Example
error: implicit declaration of function 'kill' is invalid in C99 Code Example error: implicit declaration of function 'kill' is invalid in C99 Code Example
cannot jump from switch statement to this case label c++ Code Example cannot jump from switch statement to this case label c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7