473,387 Members | 1,435 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,387 software developers and data experts.

Any ways to force the Program to halt?

Hi, I have a problem here.

Referring to the following programming structure, is there a way to cause
the computer to overflow or stop by inputting wrong values of intTime
and/or intDay? i.e. I don't want the program to jump to label NotWritten:.
but want the program to stop working when the input values are of wrong
types.

Thanks a Million
##
On Error GoTo NotWritten:
Open "c:\windows\system\aaa.txt" For Input As #f1
Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2
Close
If (intTime Mod 75) <> 0 Or (intDay Mod 79) <> 0 Then
......
End If
.......
.......

NotWritten:
.... (other statements follow)

##

Jul 17 '05 #1
2 4536
Assuming I understand what you are trying to do, if you put the statement:
On Error Goto 0
After the "Close" statement it will turn off error handling and allow the
code to break on any line producing an error during development. Depending
of course on the options you have set for error handling.
--
Jeffrey R. Bailey
"kochs" <gm*******@yahoo.com.sg> wrote in message
news:41********@news.starhub.net.sg...
Hi, I have a problem here.

Referring to the following programming structure, is there a way to cause
the computer to overflow or stop by inputting wrong values of intTime
and/or intDay? i.e. I don't want the program to jump to label NotWritten:.
but want the program to stop working when the input values are of wrong
types.

Thanks a Million
##
On Error GoTo NotWritten:
Open "c:\windows\system\aaa.txt" For Input As #f1
Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2
Close
If (intTime Mod 75) <> 0 Or (intDay Mod 79) <> 0 Then
.....
End If
......
......

NotWritten:
... (other statements follow)

##

Jul 17 '05 #2
Actually, the 3 lines

Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2

are supposed to function as check and cause the function to halt e.g. if
strJustStr1 or strJustStr2 are not string or if intTime or intDay are not
integer. However, I have put in the On Error Goto statement, which now
prevents the intended check. No matter what value I give to these numbers,
the function just ignores them and jump to the NotWritten statement.

I am now wondering if there are any integers which I can supply to
intTime/intDay to cause the function to halt when it executes these
statement.

Any help?

"Jeffrey R. Bailey" <Mr******************@yahoo.com> wrote in message
news:B5******************@tornado.tampabay.rr.com. ..
Assuming I understand what you are trying to do, if you put the statement:
On Error Goto 0
After the "Close" statement it will turn off error handling and allow the
code to break on any line producing an error during development. Depending of course on the options you have set for error handling.
--
Jeffrey R. Bailey
"kochs" <gm*******@yahoo.com.sg> wrote in message
news:41********@news.starhub.net.sg...
Hi, I have a problem here.

Referring to the following programming structure, is there a way to cause the computer to overflow or stop by inputting wrong values of intTime
and/or intDay? i.e. I don't want the program to jump to label NotWritten:. but want the program to stop working when the input values are of wrong
types.

Thanks a Million
##
On Error GoTo NotWritten:
Open "c:\aaa.txt" For Input As #f1
Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2
Close
If (intTime Mod 75) <> 0 Or (intDay Mod 79) <> 0 Then
.....
End If
......
......

NotWritten:
... (other statements follow)

##


Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Greg Fierro | last post by:
I would appreciate any help from anyone with the following: I have an external program (window32 based) that I am executing with the VBA SHELL command. This program produces a text file which I...
92
by: Raghavendra R A V, CSS India | last post by:
hie.. Do any one knows how to write a C program without using the conditional statements if, for, while, do, switch, goto and even condotional statements ? It would be a great help for me if...
5
by: Seong-Kook Shin | last post by:
Hi, I'm reading Steve's "C Programming FAQs" in book version, and have two question regarding to Q11.16 ... Also, a `return' from `main' cannot be expected to work if data local to main might be...
9
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA segment, TEXT segment, BSS segment etc. I am working...
1
by: Sladan | last post by:
Hi! I'm currently writing a poker program i .net compact framework. In one method I have a while-loop that goes through every player until everyone is finished betting. What I need is some way to...
12
by: greg | last post by:
Hi, Can anyone help me with the following issue: How can I pause the execution of a program until a given file is created (by another process) in a specified directory? Any ideas would be...
8
by: jasoncai | last post by:
Im trying to build a java program that reads user's input as a command, currently, i want to make 2 commands: Enter and Quit if the user type Enter as a command, the program will run, if the user...
13
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type...
11
by: jmnat | last post by:
Hello, Let’s assume the following piece of code : This code works fine, its output is : "Exception : Could not execute f9". Nevertheless, in the catch clause, the pointer c is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.