Could anyone please show me a working example of how to find if a file exists but is empty or not? Thanks
What is your OS? In Windows read the file size and check if it is 0 or not but for Linux there will be no zero file size for even an empty file as far as I remember.
So then check the size of the empty file in your Linux and I guess it will be 4bytes or something but not sure. If you read the file and get its size to be equal to your empty file size you assume it to be an empty file.
The getline(fileName,line) also reads the last line that is an empty line. Is there any way not to read that last empty line?