Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bbn!rochester!ur-tut!dmw3 From: dmw3@ur-tut.UUCP (David M Walsh Jr.) Newsgroups: comp.lang.pascal Subject: Re: TP problem Message-ID: <420@ur-tut.UUCP> Date: Thu, 5-Nov-87 10:22:43 EST Article-I.D.: ur-tut.420 Posted: Thu Nov 5 10:22:43 1987 Date-Received: Sun, 8-Nov-87 15:49:13 EST References: <16249@topaz.rutgers.edu> Reply-To: dmw3@tut.cc.rochester.edu.UUCP (David M Walsh Jr.) Organization: Univ. of Rochester Computing Center Lines: 46 Keywords: ennumerated type error In article <16249@topaz.rutgers.edu> jjoshua@topaz.rutgers.edu (Jonathan Joshua) writes: > > Here's the deal.. > >type dirct = (n,s,e,w,ne,se,sw,nw) ; >var v : dirct ; > >v is a variable with an ennumerated type, right? > >readln(v) ; > >gives an I/O not allowed error. I am using turbo pascal. >Am I doing something wrong or do I need a REAL compiler? > >-- >|o| Jonathan Joshua rutgers!{unirot!jjosh,topaz.rutgers.edu!jjoshua} |o| >|o| Rutgers University Delphi : bunnyhutch / Compuserve : 73637,254 |o| Yes you are doing something wrong. Readln(); gets characters and the only change it makes is to go from the chars to numbers. If you have ever tried this: var b:boolean; readln(b); you will get the same error. The fix is simple, add the following: var s:string; {you do have strings don't you?:-) } begin readln(s); if s='n' then v:=n else if s='s' then v:=s else if s='w' then v:=w else ... end; Well, It's not pretty and I'm sure that someone somewhere will yell at me for doing that, but it WILL work, and that's what every programmer wants, a working program, right? :-) :-) Good luck. Dave Walsh - an old Apple ][+ hacker, trying to be a Mac hacker residing at University of Rochester mail: rochester!ur-tut!dmw3 or dmw3@tut.cc.rochester.edu.UUCP Disclaimer: Oh, I don't really need one anyways...I'm crazy.