1#
Why isn't this working? (if it cant work with string, how do I save spaces into strings?)
cin.getline(sMovie);
2# (need to know this tonight)
How does getwidth work? I cant find good documentation on google.
tnx
1#
Why isn't this working? (if it cant work with string, how do I save spaces into strings?)
cin.getline(sMovie);
2# (need to know this tonight)
How does getwidth work? I cant find good documentation on google.
tnx
#1 cin.getline() works with c character arrays
if you use std::string objectCode:char cMOvie[255]; cin.getline(cMovie,sizeof(cMovie));
#2: I never heard of getwidth(), but that doesn't mean it doesn't existCode:std::string cMovie; getline(cin,cMovie);
To use it with strings
cin can also be replaced with a file stream, ect.Code:getline(cin,string_name);
Problem with that, if there is a space (example "The Matrix") I need to hit enter twice.Code:getline(cin, sMovie);
So how do you format your output in a console window? (with coulombs)
Last edited by Zeratulsdomain; 10-24-2005 at 08:30 PM.
Let me guess, VC6.Problem with that, if there is a space (example "The Matrix") I need to hit enter twice.
That is actually a bug in VC6. They fixed it in .net but did not fix it in any of the service packs for VC6.
Get a different compiler
http://www.cplusplus.com/ref/iostream/iomanip/So how do you format your output in a console window? (with coulombs)
Specifically look a setw
*edit*
Btw though, you can fix the getline function your self:
http://support.microsoft.com/default...;EN-US;q240015
Last edited by Enahs; 10-24-2005 at 08:48 PM.
That is a pretty well known bug in VC6, and I fixed it on my compiler, but as I remember it, it was very hard to figure out which file contained the line of code you are supposed to change: msdn didn't have clear instructions on that.Originally Posted by Enahs
This is probably the solution to the problem.
That's the same link Enahs gave. Here's another one: http://www.dinkumware.com/vc_fixes.html
The file you need to modify is <string>.