creat file for data in output folder

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2008
Posts: 20
Reputation: bamabambhole01 is an unknown quantity at this point 
Solved Threads: 0
bamabambhole01 bamabambhole01 is offline Offline
Newbie Poster

creat file for data in output folder

 
0
  #1
Sep 4th, 2008
Hii,

I have output from computation code called cdof and it is double. i want to creat a file either

cdof.log or cdof.dat where i can store values of cdof after each iteration or time step.

Please suggest me how to create files using iostream.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,846
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 753
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: creat file for data in output folder

 
1
  #2
Sep 4th, 2008
What have you tried so far?
New members chased away this month: 4
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 15
Reputation: JLChafardet is an unknown quantity at this point 
Solved Threads: 0
JLChafardet's Avatar
JLChafardet JLChafardet is offline Offline
Newbie Poster

Re: creat file for data in output folder

 
0
  #3
Sep 4th, 2008
Tip, use #include <fstream>

, wont do your homework, but a tip i know is welcome

its prety easy to use fstream, you can then call the classes you need to do the work you are looking for.
void main() { printf(" w00t "); return 0; }
José Luis Chafardet Grimaldi
Freelance Website Developer / IT Security Consultant
www.chafardet.com
http://valid.x86-secret.com/show_oc.php?id=354137
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 160
Reputation: dmanw100 is on a distinguished road 
Solved Threads: 12
dmanw100's Avatar
dmanw100 dmanw100 is offline Offline
Junior Poster

Re: creat file for data in output folder

 
0
  #4
Sep 5th, 2008
  1. #include <fstream>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a = 1;
  8. fstream yourFile;
  9. yourFile.open("log.txt");
  10. yourFile >> a;
  11. yourFile.close();
  12. return 0;
  13. }

Something like that. Maybe the ">>" needs to be "<<".
Last edited by cscgal; Sep 5th, 2008 at 2:06 am. Reason: Fixed code tags
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC