Connecting Tech Pros Worldwide Forums | Help | Site Map

How to close an empty file

Newbie
 
Join Date: Oct 2006
Posts: 22
#1: 3 Weeks Ago
First of all I apologise for asking a simple question.
Here's the problem
I am having trouble closing a file in my program.

Sample code
open "c:\file.txt" for input as #1
line input #1, Data
close #1

This works if the file contains data

If the file is empty though it is skipping the close statement causing the program to fallover the next time I open a file as #1.

Can anyone help this idot.

Newbie
 
Join Date: Oct 2006
Posts: 22
#2: 3 Weeks Ago

re: How to close an empty file


Since this post I have put a errorhandler in as follows

errorhandler:
select case err.number
case 55
close #1
end select
resume

This keeps the program running but doesn't solve my basic programming error.
Reply