So, I just recently deleted my previous post from last night and I've been working with it to consolidate and try to touch up my screw-ups...boo...

Anywho, I am basically trying to read in values from .dat files from a folder that is in the current directory of the program. I am running Linux if that matters...

So, kind instructions to those who are willing to help:

1.) make a new directory in your home folder "FOLDER", make a folder named "DATA" inside "FOLDER", and then make up two .dat files with whatever integers you want, and however many integers you want.
2.) Next, copy and paste this .cpp code into "FOLDER" and try compiling/running.

The instructions I have told you are exactly where my .dat files are and my .cpp code. When I run the program, I get this error:

Enter directory with files available for use: InputFiles/
Error(2) opening InputFiles/
What is wrong with it? I don't understand...

Here is my code, and I apologize sincerely for the long post. If you see any errors (which I'm sure there will be plenty!!), do not be bashful. Let me know! Oh, and my CalcMax() function isn't complete FYI, but I can do that on my own time. If you are using Windows/Mac, please change the instructions as necessary...Thank you in advance for all the help!!! Let me know ASAP please!

Code:
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstring>

using namespace std;
typedef vector<string> stringVector;  //Defines a vector of string values
const int MAX_SIZE = 31;

void OpenInputFile(ifstream&, string);
void OpenOutputFile(ofstream&, string);
int ReadArray(ifstream&, int[]);
float CalcAverage(int[], int array_size);
float CalcMax(int array[], int array_size);
int getDir(string dir, stringVector &files);

int main()
{
    ifstream indiv_file;
    ofstream ofs_max;
    ofstream ofs_average;
    int array[MAX_SIZE], next, count = 0;
    float average_temp, maximum_temp;
    int array_size;
    string dir, out_file_max = "MaxsOfArrays.txt", out_file_average = "AvgsOfArrays.txt";
   
    cout << "Enter directory with files available for use: ";  //Lists the files in the current directory you could input .
    cin >> dir;
    stringVector files = stringVector();
    OpenOutputFile (ofs_max, out_file_max);
    OpenOutputFile (ofs_average, out_file_average);
    
    getDir (dir, files);
   
    int fsize = files.size();
    for (unsigned int i = 0; i < fsize; i++)
    {
        count = 0;
       
        if (files[i].at(0)!= '.') // if the file is a valid file
        {
            cout << endl << dir + files[i] << endl;
            indiv_file.open((dir + files[i]).c_str());
           /*if (indiv_file.fail())
           {
              cout << "Fail";
              return 0;
           }*/
           
	   OpenInputFile (indiv_file, (dir+files[i]));
           array_size = ReadArray(indiv_file, array);
           average_temp = CalcAverage(array, array_size);
           //maximum_temp = CalcMax(array, array_size);
         
           while (indiv_file >> array[count])
           {
                 cout << array[count];
                 count++;
                 if(count == MAX_SIZE)
                     break;
           }
           for (int j = 0; j < array_size; j++)
               {
               cout << array[j] << " ";
           }
          
        }
        indiv_file.close();
     }
    return 0;
}
//--------------------------------
int getDir (string dir, stringVector &files)
{
        DIR *dp;
        struct dirent *dirp;
       
        if((dp  = opendir(dir.c_str())) == NULL) {
                cout << "Error(" << errno << ") opening " << dir << endl;
                return errno;
        }
        while ((dirp = readdir(dp)) != NULL)  {
                files.push_back(string(dirp->d_name));
        }
        closedir(dp);
        return 0;
}
//---------------------------------------
void OpenInputFile(ifstream &in_file, string file_name)
{
     in_file.open(file_name.c_str());
     if (in_file.fail())
     {
        cout << "Failed to open file." << endl;
        exit(1);
     }
}