I have 2d array (float) having some values , i want my program create a file if it not exist , and i want to write the values of 2d array (float) in this file , please can any one help me , I am beginner in programming .
I have 2d array (float) having some values , i want my program create a file if it not exist , and i want to write the values of 2d array (float) in this file , please can any one help me , I am beginner in programming .
check this link out:
Input/Output with files
This code creates a file called example.txt and inserts a sentence into it in the same way we are used to do with cout, but using the file stream myfile insteadCode:#include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile.close(); return 0; }
You're doing matrix multiplication with MPI, and yet you can't figure out how to write to a text file? Dude, your priorities are out of whack here.