Writing to a file, it doesn't seem to be working for me...
I'm supposed to write my results to two files, and it doesn't seem to be working at all. With my code below, what's my problem. Please answer ASAP! Thanks for all of the help in advance!
void OpenOutputFile(ofstream&, string);
int array[MAX_SIZE], next, count = 0;
float average_temp, maximum_temp;
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];
OpenInputFile (indiv_file, (dir + files[i]));
array_size = ReadArray(indiv_file, array);
average_temp = CalcAverage(array, array_size);
maximum_temp = CalcMax(array, array_size);
/* for (int j = 0; j < array_size; j++) // If you want to read out the data
cout << array[j] << " ";
files[i].erase(files[i].find("."), 5); //Deletes anything after AND including the 'dot' in the filename.
cout << endl << "The average temperature in " << files[i] << " was: " << average_temp << endl;
cout << "The maximum temperature in " << files[i] << " was: " << maximum_temp << endl;
ofs_max << "The maximum temperature in " << files[i] << " was: " << maximum_temp << endl;
ofs_average << "The average temperature in " << files[i] << " was: " << average_temp << endl;
cout << endl;
void OpenOutputFile(ofstream &out_file, string file_name)