I am trying to output a file with the values of an array written in columns. Here is a simple reproducible version of my code:
# include <iostream>
# include <fstream>
# include <math.h>
# include <iomanip>
# include <cmath>
# include <stdlib.h>
# include <cstdlib>
//# include <fstream.h>
# include <string.h>
# include <string>
//# include <dos.h> //For Sleep() 
using namespace std;
int main()
{
    char outputFileName[30] = "output.dat";
    int NumOfRows = 5;
    int nCount[5] = {0, 1, 2, 3, 4};
    int nCount2[5] = {1, 2, 3, 4, 5};
    
    cout<<"Creating output file"<<endl;
    ofstream outFile(outputFileName);
    outFile<<"1st Param"<<setw(15)<<"2nd Param"<<endl; //Header
        for (int a = 1; a < NumOfRows; a++){
            
            // Reading rest of file
            outFile << nCount[a] << nCount2[a];
                
        }
    outFile<<""<<endl;
    
    return 0;
}
I am running this using CINT/ROOT C/C++ Interpreter version 5.18.00. However, when I run this, there is no output.dat produced. I have tried searching for it but it is nowhere on my computer. Any suggestions?
Edit: I have added the following to the code to check the output file
            // Warning if file cant be opened
    if(!outFile.is_open()){ 
        cout << "Error opening file. \n";
        //cout << "Giving Retry... \n";
    }
    if(outFile.is_open()){
        cout<<"Output File was opened successfully"<<endl;
    }
    if(outFile.good()){
        cout<<"Output File is ready for reading"<<endl;
    }
    outFile.close();
    
    if(!outFile.is_open()){
        cout<<"Output File closed successfully"<<endl;
    }
When I run the code now, this is the output:
Creating output file
Output File was opened successfully
Output File is ready for reading
Output File closed successfully
The output.dat is still missing however.
