Advertisement

Cin.get().... with char* or string?

Started by October 13, 2002 06:52 PM
2 comments, last by Alpha_ProgDes 22 years, 1 month ago
char line[25]="Hello!"; string line="Hello!"; i looked in MSDN and it said that you can only use cin.get like this: cin.get (line, 25); // for char* only. and i tried it with a string. and VC6 was telling it had to be a char*. is there a way to use a string (with whitespaces)?

Beginner in Game Development?  Read here. And read here.

 

Yu could just set the string to equal the char* after you read it.
Advertisement
getline(cin, stringvar);
I''d go with Beer Hunter''s suggestion.

This topic is closed to new replies.

Advertisement