Dev-C++ file writing
Well I decided to try using Dev-C++ as I pick up the programing thing again. I have been using MVC6 intro. Which was all well and fine if you don''t want to pass the EXEs around. So as I was pulling some of my startup code over to Dev I ran into a problem writing files. Just trying to open a log file to send info to. I didn''t think there was much room for error with...
ostream logfile("logfile.txt");
logfile << "Send Info and stuff to file\n";
logfile.close();
but the thing said
"''ostream'' is used as a type, but is not defined as a type."
I can''t find any info that shows any real other way to do things. Anyone know what the hell it wants or had this happen? This should be basic stuff. I''d rather be spending time on a real bug and not something stupid like this.
Did you include <fstream>? Also, ostream lives in namespace std. So either use std::ostream, or put a using declaration in your source file (either using namespace std; or using std::ostream;).
edit: for that matter try using ofstream instead of ostream. Creating an ostream by file name may not make much sense.
[edited by - SiCrane on March 18, 2004 2:50:19 PM]
edit: for that matter try using ofstream instead of ostream. Creating an ostream by file name may not make much sense.
[edited by - SiCrane on March 18, 2004 2:50:19 PM]
std::ostream and using std::ostream give me this
no matching function for call to `std::basic_ostream >::close()''
Whatever that means.
no matching function for call to `std::basic_ostream >::close()''
Whatever that means.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement