Archived

This topic is now archived and is closed to further replies.

Dev-C++ file writing

This topic is 5016 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites