Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File testing

Status
Not open for further replies.

icepee

Programmer
Feb 27, 2005
2
0
0
BE
fredericofonseca, thank you for your help earlier, it was a big help and it worked. Now i have another question, I need to test the file, i have to test if the file exists, if it exists i have to test that the file is a good file, with this i mean that the file is suitable for my record discription. Any thoughts on this would be welcome

thanx

icepee
 
icepee,

As my previous reply were of help to you, then you should go to that thread and post a message stating so, along with your solution as I did not give it directly to you. This will enable others to benefit from the solution.

Whenever you try to open a file, if this file is an indexed/relative file the filestatus will tell you if it was a good file or not. If the file definition from your program does not match the physical file you will receive an error. If the file does not exist you will also receive an error. Each situation will raise a different error but which error depends on your compiler vendor/version.

If the file is a plain line sequential (e.g. free text), then there is not way to directly determine if the file is a valid one until you have read one/several records, and compare any record type identifier with an internal definition.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top