c++ output file stream.

Status
Not open for further replies.

natasie

Member level 2
Joined
Jul 11, 2011
Messages
48
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,629
hey everyone,

i am trying to to program an mm1 queue and send the data to a file named happy.csv.

below is the simple program that i have used just for example


using namespace std;

int main () {

int item_no=1;
ofstream out("happy.txt");
if (!out){
cout<<"Cannot open file"<<endl;
return 1;
}
out<<"item: "<<item_no<<endl;
out.close();
return 0;
}

i do not know however how this works, is it not supposed to show on the file named happy.csv? each time i simulate it, theres really no output from it.
please anyone like to help my confused state of mind and clarify this up for me?

thanks
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…