<space> delimiter in string class causes program to crash when " " charachter is ent
I am trying to run a standard win32 console application, e.g. simple "Hello World" style app just to test this stupid "bug" or whatever it is.
Does anyone know how to use the cin >> statement to store a " " character into a string variable
e.g.
#include <iostream>
#include <string>
using namespace std;
void main ()
{
string somestring;
cin >> somestring;
cout << somestring;
char somechar;
cin >> somechar;
}
when the cin statement asks for text it will go fine unless a space is entered into the string. When a space is present hitting enter after the string crashes the program and it does not even run the cout statement. There is no error, it just exits. I tried it with a character array too and it did the same thing.
I am using Microsoft Visual Studio.net through my school and it is a horrible program. I see source code all the time where this problem isn't an issue, should i switch compilers?
Any Suggestions?