Im having a problem trying to figure out why my file is returning 0's instead of the numbers inside the file, here is the code I did in C++ on reading a file:
    #include <cstdlib>
    #include <iostream>
    #include <fstream>
    #include <string>
    using namespace std;
    string cfile;
    int cnum1,cnum2,cnum3,cnum4;
    bool fired = false;
    /*
     * 
     */
    void printMatrix(double **x, int n)
    {
        int size = n;
        for(int i=0; i<size; i++)
        {
            for(int j=0; j<size; j++)
            {
                std:: cout << x[i][j] << " " ;
            }
            std:: cout << std::endl;
        }
    }
    void readFile(string file,double **x, int n)
    {
        std::ifstream myfile(file.c_str());
        int size = n;
        for(int i=0; i<size; i++)
        {
            for(int j=0; j<size; j++)
            {
                myfile >> x[i][j];
            }
        }
    }
    void GetCommandLineArguments(int argc, char **argv,string &file, int &n, int &k, int &m, int &i)
    {
        if( argc == 6 )
        {
            cfile = argv[1];
            cnum1 = atoi(argv[2]);
            cnum2 = atoi(argv[3]);
            cnum3 = atoi(argv[4]);
            cnum4 = atoi(argv[5]);
        }
        file = cfile;
        n = cnum1;
        k = cnum2;
        m = cnum3;
        i = cnum4;
    }
    int main(int argc, char** argv) {
        int k; //Factor of n
        int m; //Innner matrix size
        int i; //Iteration
        int n; //Matrix Size
        string file;
        GetCommandLineArguments(argc, argv, file, n, k, m, i);
        double **matrix;
        matrix = new double*[n];
        for(int i = 0; i<n; i++)
            matrix[i] = new double[n];
        for(int j=0; j<n; j++)
            for(int i=0; i<n;i++)
                matrix[i][j] = 0;
        readFile(file, matrix, n);
        printMatrix(matrix, n);
        return 0;
    } 
And here is a sample of my file containing the values I want to extract from it:
20.0
20.0
20.0
20.0
20.0
200.0
20.0
200.0
Hope someone can help me out since I researched some info about this and didn't really find a solution.
 
     
     
     
    