Heap Sort in C with I/O