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

What have you tried so far?

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.

#include <fstream>
#include <iostream>
using namespace std;

int main()
{
     int a = 1;
     fstream yourFile;
     yourFile.open("log.txt");
     yourFile >> a;
     yourFile.close();
     return 0;
}

Something like that. Maybe the ">>" needs to be "<<".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.