I just converted a C++ program from using extended characters to basic strings. But now it crashes on startup with the following error:
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct null not valid
The input function I use is this
string getString()
{
fflush(stdin);
fflush(stdout);
string io;
cin >> io;
cout << io << endl; //input test/confirm
return io;
}
Is it this or something else?
(note: I already tested the buffer flushes and they aren't causing the problem)
Pastebin the entire program. This shouldn't be causing a crash, so I suspect its somewhere else in your program.
Also, why teh convert to strings? Any particular reason?
Quit working with constant characters, kept giving segmentation faults. I don't know why, it was working before. The program is over 1400 lines...single page, but I'll get rid of the easter eggs and junk first, then I'll pastebin it.
EDIT:I commented out the entire main function and it still crashed. It has to be in the other fuctions or variable declarations.
void fatal(string message)
{
cout << "fatal " << message << endl;
PlaySound("F:\\am-i-totally-screwed-or.wav", NULL, SND_SYNC);
exit(-1);
}
float totalResistance = 0;
float totalCapacitance;
const double PI = 4.0*atan(1.0);
double e = 2.71828182845904523536028747135266249775724709369995; /// if needed
(((((string typeOfCircuit = (0);))))) EDIT: Naughty, Naughty variables.
(((((string connection = (0);)))))))
float C = 0;
int count = 0;
int R[0];
float Ca[0];
float L[0];
float ca[0];
double incvrt = 0.0393700787;