473,698 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\sys tem\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 4550
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*******@yaho o.com.sg> wrote in message
news:41******** @news.starhub.n et.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\sys tem\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.co m> wrote in message
news:B5******** **********@torn ado.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*******@yaho o.com.sg> wrote in message
news:41******** @news.starhub.n et.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
32672
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 have to read after the external program finishes. I use the transfertext method to read the file. The problem is that the SHELL command executes external programs in an asynch way. In other words, the VBA code will continue running and NOT...
92
9865
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 someone helps me... Urgent - Please reply soon ! Thanks, Raghu
5
2803
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 needed during cleanup. (Finally the two forms are obviously not equivalent in a recursive call to `main'). My questions are
9
4530
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 on linux platform and my target is ARM processor. But i guess it should not matter. Actually i need to know both RAM & ROM usage.
1
1251
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 halt the while-loop until the user makes a decision (presses a key) and then continue. How can I do this? Thanks!
12
3327
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 highly appreciated. Thanks!
8
1790
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 type Quit, the program will halt. how can i justify whether its a Quit command or a Enter command? Also, how can I vertify if they write the command in prefix, for example, instead of type Quit, the user typed Q, or Qu, or Qui, ignore the case 2.
13
3914
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 Chinese characters, but neverthelss is unable to show them up on screen. The follow is some of the error message I received after I logged off the program: "Could not write output: <type "exceptions: UnicodeEncodeError'>, 'ascii' codec can't...
11
4049
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 indeterminate, the pointee may have been lost.
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9027
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.