🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sbcs.cse114
Article #8

Re: pascal trouble

#8
From: Charles F Lane
Date: Mon, 13 Apr 1992 18:29
36 lines
2650 bytes
In article <1992Apr12.024103.27635@sbcs.sunysb.edu> dtiberio@csws7.ic.sunysb.edu (David Tiberio) writes:
>
>	I have to do a database option where the user presses
>RETURN if he does not want the data changed. The string read
>in is an array of length 9. This is what I tried:
>
>	if string = '         ' then data_does_not_change;
>
>	This line is not being read for some reason the way
>I would expect it to. Should this work? It could be that I forgot
>something somewhere else, but I have had problems like this
>throughout this program.
     Well fellow Stony Brooker, I think the above means if the user
presses the spacebar 9 times and presses return then data_does_not_change.
A better test would be to see if the length of the string is zero.  This
is done by checking string[0].  The 0th index of a string contains it's
length.  But I'm not sure if this value is always 9 since you said the
string has length 9 (declared in type declaration I'm assuming).  Another
way would be to save the string before return is pressed and do:
 if StringBeforeReturn = StringAfterReturn then data_does_not_change;
This is assuming readln leaves a string unchanged if only return is pressed.
To be sure, you can writeln the string to screen before return, press
just return, and writeln the string again.  See what happens.  If the string
is untouched you can use the last method I described.
Maybe someone who knows more about strings can verify/add to all this! :-)
But do experiment a little like suggested above.  You can find out a lot
if you peek at what's going on with variables before/after things happen...

>      //   David Tiberio  SUNY Stony Brook 2-3662  AMIGA  DDD-MEN   
>     //  Not the llama! Come here Earl; I want to tell you something...
>   \X/  Liverpool, New York	flames to suggestions@cbmvax.commodore.com

-- 
~~~~~~~ I'm (sine)waving goodbye!  | Bo knows football, basketball, baseball,
Charles F. Lane                    | hockey, diddley, etc.  But does he know
clane@Libws1.ic.sunysb.edu         | computers?!
Technical Details
Message-ID: <1992Apr13.182945.12825@sbcs.sunysb.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!darwin.sura.net!udel!sbcs.sunysb.edu!libws1.ic.sunysb.edu!clane
References: <1992Apr12.011409.26898@sbcs.sunysb.edu> <1992Apr12.024103.27635@sbcs.sunysb.edu>

Show Full Headers
Complete Article Headers
Newsgroups: sbcs.cse114,comp.lang.pascal
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!darwin.sura.net!udel!sbcs.sunysb.edu!libws1.ic.sunysb.edu!clane
From: clane@libws1.ic.sunysb.edu (Charles F Lane)
Subject: Re: pascal trouble
Message-ID: <1992Apr13.182945.12825@sbcs.sunysb.edu>
Sender: usenet@sbcs.sunysb.edu (Usenet poster)
Nntp-Posting-Host: libws1.ic.sunysb.edu
Organization: State University of New York at Stony Brook
References: <1992Apr12.011409.26898@sbcs.sunysb.edu> <1992Apr12.024103.27635@sbcs.sunysb.edu>
Distribution: na
Date: Mon, 13 Apr 1992 18:29:45 GMT
Lines: 36