473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to close an empty file

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.
Nov 5 '09 #1
1 1081
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.
Nov 5 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns...
1
by: Daniel | last post by:
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a...
4
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed...
4
by: mimi | last post by:
Hi Please help me out, I can't find a way to close a sqldatareader when error occur at statement cmd.ExecuteReader(). I can't close it in catch because it is local in try scope and I can't...
3
by: Joris De Groote | last post by:
Hi, I use Adobe Acrobat to read tekst from PDF files. After that the file has been read, I move the file in a folder (using the date I got from the text I got from Acrobat). Now here is my...
1
by: Nico Grubert | last post by:
Dear Python developers, I use a short python script in order to run an external application plus to open a browser displaying a default page. My Setup: Python 2.4.3. / Windows2000 #...
0
by: bloombloom | last post by:
I am gonna post my AS in hopes that someone can get a good understanding of what i am doing. So here is the code: t1.onRelease = function() { infoField._visible = true; startLoading("cc11.swf");...
1
by: atiq | last post by:
once the feedback is submitted the thank.html popups. however, i want this popup to only be displayed for 3 seconds and then for this window to automaticaly close it self. below is the code for...
3
by: Kelii | last post by:
I've been beating my head against this problem for the last several days, and I haven't found a decent solution yet. So I'm turning to the group for some moral support or better yet some answers. ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.