Why is nothing getting written to my file?

I'm supposed to read a text file of unsorted numbers, sort them, and then write them to an output file. But when I open the file that I wrote to, the only thing on it is a bunch of zeros.

int main()
{
unsigned int size = 10000000;
ifstream inFile("numbers.txt");
inFile >> size;
unsigned int * nums = new unsigned int[size];
for (int i = 0; i < size; i++)
{
inFile >> nums[i];
//cout << "number " << i << ": " << nums[i] << endl;
}

inFile.close();

Sort obj(size);
Merge obj2(size);
Heap obj3(size);
Quick obj4(size);

clock_t startTime, endTime;

startTime = clock();
//obj4.quickSort(nums, 0, size-1);
//obj3.heapSort(nums, size);
obj2.mergeSort(nums, 0, size - 1);
//obj.selectionSort(nums, size);
endTime = clock();

ofstream outFile("numbersNew.txt");
for(int i = 0; i < size; i++)
{
outFile << nums[i] << endl;
}
outFile.close();

cout << "Sort took: " << endTime - startTime << " milliseconds" << endl;
//
// //for (int i = 0; i < size; i++)
// // cout << nums[i] << endl;

return 0;
}

Here is the rest of my code:
https://pastebin.com/rY8QxsJy
Make sure that it opens the numbers.txt file successfully.
Is "numbers.txt" blank? Or do you really have a text file with 10 million numbers? I find it odd that you are reading the file 10 million times, not reading it until EOF. It, among other problems, suggests that you didn't think this part of the program through.
@Computergeek01, the actual allocated array is based on a size read from the file. The ten million is just a meaningless value.

Anyway, the constructors of the sort objects (obj, obj1, etc) receive the given size and create a member array of that size. But that array is never used (never filled, sorted, anything), so it might be all zeroes (although that wouldn't be guaranteed). Maybe you were trying to print it (at some point; your code doesn't seem to do that now).
Topic archived. No new replies allowed.