How to convert from string to char in C++?

Let’s learn how to convert from string to char in C++. The most accurate or helpful solution is served by Stack Overflow.

There are ten answers to this question.

Best solution

How to Convert int to char*(string) in C++?

SOCKET lhSocket; int iResult; lhSocket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); char *sendbuf = "this is a test"; iResult = send(lhSocket, sendbuf, (int)strlen(sendbuf), 0 ); printf("Bytes Sent: %ld\n", iResult); I have client and Server program using sockets in C++ now i send a buffer it is received by server now when server acknowledge me back saying i got your packet i should get that in string format not bytes received : something. how to achieve that ? My iresult returns...

Answer:

sendbuf is the string which you are sending. Print sendbuf instead: printf("Bytes Sent: %s\n"...

Read more

Swapnil Gupta at Stack Overflow Mark as irrelevant Undo

Other solutions

Answer:

What language? Whatever language it is, just google "how to convert a char array to a string in...

Read more

Shahid Z at Yahoo! Answers Mark as irrelevant Undo

Answer:

The toString method returns a string object representing this character's values.

Read more

Anonymous at ChaCha Mark as irrelevant Undo

Answer:

string str = 'W';

Read more

William Hu at Quora Mark as irrelevant Undo

How to convert a string to a double?

I need to convert the value of String-avg to the double-numberGrade. Thanks a lot for your help. import javax.swing.JOptionPane; public class April3 { public static void main(String [] args) { String avg; double numberGrade; char letterGrade; while ...

Answer:

You could just have getLetter return a String instead of a char, and put "A", "B"...

Read more

Wayne at Yahoo! Answers Mark as irrelevant Undo

Char to string trouble?

I have to create a class in order to check if a string is palindrome or not and i have to convert the char to string as char s in compatible with return jump statement. Is there a way to do so? I am using netbeans 7.0.1 Any suggestions?

Answer:

let's assume your char is named as ch... so char ch; String str=""; // insert char str+=ch...

Read more

Yahoo! Answers Mark as irrelevant Undo

String to unicode char in java?

How do I convert a string like "\u003C" which represents a single unicode character into a char like '\u003C' ?

Answer:

char( 'A' ) = 65

Read more

Vivek N at Yahoo! Answers Mark as irrelevant Undo

String to Integer Java question?

I have to take a string, like "2112211241" or something and convert it into an integer array, but have no idea how. I wanted to do for(int j = 0; j < i; j++) { for(int q = 0; q < 10; q++) { char temp = studentAnswers[j].charAt(q); studentIntAnswers...

Answer:

You're right: there isn't a method to parse a char into an int but there is a method to parse a string...

Read more

Hayden at Yahoo! Answers Mark as irrelevant Undo

HASKELL program, convert binary to decimal?

convert'::String->Int convert' bits = foldr help 0 bits where help :: Char->Int->Int help b rr = 2*rr+(digitToInt b) what am I doing wrong....

Answer:

Your structures seem messed up. Try adding some more structures so I can assist you.

Read more

Sam at Yahoo! Answers Mark as irrelevant Undo

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.