hello
I have an inquiry about reading from a file. so if i have a file and if it opens (meaning it is there) how do i check if there is data?
ifstream file("example.txt");
if (file.good())
{
//file.open("example.txt"); // is this necessary again???????? i read that the ".good" provide checking if file exists AND opens it if it does
//check if there is data...how????
}
.....
i know if i have like getline and if it cant get anything, the program will obviously crash/not build, but instead of crashing, i want to make it a message that there is no data in file.
thanks in advance