I don't see how
size_t fileSize = inputFile.tellg();
is working as I cannot see you move the file pointer to the end-of-file beforehand?