popkin@ceawlin.cs.odu.edu (Brian N. Popkin) (05/09/91)
I am writing a simple poker game in turbo pascal v6.0.. I am using the crt unit.. I noticed that the checkbreak function only works part of the time. ex) program poker(input,output); uses crt; var CheckBreak : Boolean; begin { extra code deleted } CheckBreak := FALSE; end. in the previous program, when I hit control-break, it still breaks and doesn't disable the break key.. any suggestions? Brian *-----------------------------------------------------------------------------* * Brian Popkin - Computer Science Major - Systems Programing * * Old Dominion University - Norfolk, Virginia USA * * * * Others Areas Of Interest: Artificial Intelligence, Expert Systems, * * Networks, And Telecommunications * * * * Email Address: popkin@cs.odu.ede - popkin@xanth.cs.odu.edu * *-----------------------------------------------------------------------------*
magyar@inside.caltech.edu (Igen Magyar Istvani) (05/09/91)
In article <1991May9.032547.13756@cs.odu.edu> popkin@ceawlin.cs.odu.edu (Brian N. Popkin) writes: > >I noticed that the checkbreak function only works part of the time. > >ex) > >program poker(input,output); > >uses crt; > >var > CheckBreak : Boolean; > >begin > > { extra code deleted } > > CheckBreak := FALSE; >end. > >in the previous program, when I hit control-break, it still breaks and >doesn't disable the break key.. > >any suggestions? Hmm... from the above, it looks like you should set CheckBreak at the _beginning_ of your program, not the end. (Or did you mean that the extra code was deleted after you set CheckBreak?) At least, I haven't seemed to have any problems with the CheckBreak variable. Ted Turocy magyar@through.cs.caltech.edu ---------- "It _should_ have been called the Hungaro-Austrian Empire."
popkin@cs.odu.edu (Brian N. Popkin) (05/09/91)
Just to clear some things up, I set it the first thing I do I ment.. Brian
tsmith@plains.NoDak.edu (Timothy Lyle Smith) (05/09/91)
I don't have TPW6.0 but in TPW5.5 the variable CheckBreak is already defined in the CRT unit. By defineing CheakBreak locally, when you assign a value to it you are only changing the local variable. The CRT unit code does not check your local variable so checking is done as the default value for CheakBreak is true. So regardless of what you set your local CheckBreak to your program will always check for Ctrl-Break. If you need a local CheckBreak variable then to set the CRT unit CheckBreak use: CRT.CheckBreak := false; This will always set CheckBreak to false. The easist way would be to remove the definition of CheakBreak from your program. -- Tim Smith Minard 300 UUCP: ...!uunet!plains!tsmith North Dakota State University, BITNET: tsmith@plains.bitnet Fargo, ND 58105 INTERNET: tsmith@plains.NoDak.edu
ts@uwasa.fi (Timo Salmi) (05/10/91)
In article <1991May9.032547.13756@cs.odu.edu> popkin@ceawlin.cs.odu.edu (Brian N. Popkin) writes: >I am writing a simple poker game in turbo pascal v6.0.. >I am using the crt unit.. >I noticed that the checkbreak function only works part of the time. : >any suggestions? : A roundabout one of simple experimental logic. Does the same problem appread in earlier versions of TP with our program? If it does, then there is probably something wrong with your code, if not then the doubts shift to TP 6.0. ................................................................... Prof. Timo Salmi Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.12.37 School of Business Studies, University of Vaasa, SF-65101, Finland Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun
cs202216@umbc5.umbc.edu (cs202216) (05/10/91)
In article <1991May9.032547.13756@cs.odu.edu> popkin@ceawlin.cs.odu.edu (Brian N. Popkin) writes: >I am writing a simple poker game in turbo pascal v6.0.. > >I am using the crt unit.. > >I noticed that the checkbreak function only works part of the time. > >ex) > >program poker(input,output); > >uses crt; > >var > CheckBreak : Boolean; > { Stuff deleted } > >in the previous program, when I hit control-break, it still breaks and >doesn't disable the break key.. > >any suggestions? > >Brian > The problem with this is the VAR CheckBreak : boolean in the beginning. Take that out, and it will work. -- Internet: cs202216@umbc5.umbc.edu (Matt Gove)
nkraft@crash.cts.com (Norman Kraft) (05/10/91)
>In article <1991May9.032547.13756@cs.odu.edu> popkin@ceawlin.cs.odu.edu (Brian N. Popkin) writes: >I noticed that the checkbreak function only works part of the time. > >program poker(input,output); > >uses crt; > >var > CheckBreak : Boolean; > >begin > { ... } > CheckBreak := FALSE; >end. > >in the previous program, when I hit control-break, it still breaks and >doesn't disable the break key.. > >any suggestions? Well, if you coded it a above, it's not likely to work. CheckBreak is a variable declared within CRT. By redeclaring it above, you override the CRT reference, and make "CheckBreak := FALSE" a statement which cannot have the desired effect. Either remove the CheckBreak variable declaration, or (if for some reason you need a variable by that name) change the above line of code to CRT.CheckBreak := False; Norm. -------------------------------------------------------------------------- Norman Kraft INET : nkraft@bkhouse.cts.com Director, Software Development UUCP : ucsd!bkhouse!nkraft Postal Buddy Corporation GEnie: N.KRAFT3 San Diego, CA FIDO : 1:102/943 FAX : (619) 272-3175 "Things should be as simple as possible, but not simpler." - A. Einstein -------------------------------------------------------------------------- -- -------------------------------------------------------------------------- Norman Kraft INET : nkraft@crash.cts.com Director, Software Development UUCP : ucsd!crash!nkraft Postal Buddy Corporation GEnie: N.KRAFT3
rfh3273@galileo.rtn.ca.boeing.com (Dick Harrigill) (05/10/91)
In article <1991May9.032547.13756@cs.odu.edu> popkin@ceawlin.cs.odu.edu (Brian N. Popkin) writes: >I am using the crt unit.. >I noticed that the checkbreak function only works part of the time. >... >var > CheckBreak : Boolean; You are redefining the CheckBreak variable. This is already decalared for you in the crt unit. Simply remove your own declaration and it should work fine. If you want to reuse the CheckBreak identifier, refer the the one in crt as: crt.checkbreak -- Dick Harrigill, an independent voice from: Boeing Commercial Airplanes M/S 9R-49 PO BOX 3707 Renton Avionics/Flight Systems Seattle, WA 91824 Computing Support (206) 393-9539 rfh3273@galileo.rtn.ca.boeing.com
defaria@hpcupt3.cup.hp.com (Andy DeFaria) (05/14/91)
>/ hpcupt3:comp.lang.pascal / magyar@inside.caltech.edu (Igen Magyar Istvani) / 9:26 pm May 8, 1991 / >program poker(input,output); > >uses crt; > >var > CheckBreak : Boolean; > >begin > > { extra code deleted } > > CheckBreak := FALSE; >end. > >in the previous program, when I hit control-break, it still breaks and >doesn't disable the break key.. > >any suggestions? The above code merely sets your OWN CheckBreak Boolean variable to FALSE. Perhaps you should not define a CheckBreak variable and let TP set the real CheckBreak variable.