ifstream and strings
I take in a line of text at a time from a file, do my parsing and organizing, append it all to my big finale' string and do the funky chicken, then my data is ready to be written to a file.
Everything is dandy for me up until I get to actually writting the string. I created a simplified variation of my sample code which still produces the error, then I cut it down to this to show who ever may help me. Here it is:
Essentially it doesn't want a const char* and it's getting one... so how exactly do I go about getting my string from this state in to my file?
string name, pass, final; // all strings
[ ... blabla .. ]
final.append("INSERT INTO `data` VALUES (1, '");
fout.write(final.c_str()); // <---- Fails Here
I attempted to creat a char* which pointed to the string.c_str() and casted which failed, I then realized I was guessing and who know where I would go after that so someone please help.
Perhaps you wish to write:
fout << final << "\n";
No kidding? Oh my, I spent some time on this... and if that's the sollution then damn....
update: Thank you. : ]
another: I think this was one of those 'very late night stupid things' for me, now i'm seeing it everywhere, had i only looked at the << operator instructions on the websites. -sigh-