How do I check if a text file havea required format ?
eg. Format :
<product number> <description> <price>
How do I check if a text file havea required format ?
eg. Format :
<product number> <description> <price>
if a file has to have a specific format such as the one you mentioned, i am assuming that you or your program are also the ones creating the file.
in that case, you could write out a standard header that all files of this type have to have. when you read in the file, if the header fails then the file format is invalid.
even if someone else is writing the file, if it is a text file you can require a certain header, but the only problem is all the people that are creating files of this type would need to know the format of the header.
otherwise, the only thing you can do is read it in and hope...
I came up with a cool phrase to put down here, but i forgot it...