Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!fsbrn@BRL.ARPA From: fsbrn@BRL.ARPA (VLD/LTTB) Newsgroups: comp.lang.pascal Subject: Re: TP problem Message-ID: <10228@brl-adm.ARPA> Date: Sun, 8-Nov-87 18:38:20 EST Article-I.D.: brl-adm.10228 Posted: Sun Nov 8 18:38:20 1987 Date-Received: Wed, 11-Nov-87 02:45:21 EST Sender: news@brl-adm.ARPA Lines: 33 Haah, According to "Programming in Pascal" by Grogono (my favorite Pascal text): "Unfortunately, it is not possible in standard Pascal to read or write a scalar [enumerated] value directly." (page 127) Assuming you are writing to a text file, how should the enumerated value be written so that it could be read in again by another program? If you are writing to a non-text file, say a file of a user-defined record type, then the enumerated value may be written as a byte whose value is the "index" number of the item within its enumerated set. (That sounds confusing; it simply stores ORD(value).) Now if any write of an enumerated value wrote an integer, then you could read it in as a different enum; eg, write ORD(first_member_set1) and then read it back into a variable of a different type. Definitely apples and oranges here. A brief scan thru my TP 3.0 manual didn't turn up any specific mention of this problem, so I assume TP follows the standard here. A workaround (TP-specific) is the following: write(ord(enum_variable)); { when you need to store the enum value } read(int_variable); { read integer and convert to enum value } enum_variable := enum_type(int_variable); See page 65 for further details and a nice example. dsw, fferd Fred S. Brundick USABRL, APG, MD.