Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!aurora!amelia!ames!hao!gatech!purdue!i.cc.purdue.edu!h.cc.purdue.edu!s.cc.purdue.edu!ags From: ags@s.cc.purdue.edu (Dave Seaman) Newsgroups: comp.lang.pascal Subject: Re: Sun Pascal bug? Message-ID: <2342@s.cc.purdue.edu> Date: 26 Feb 88 14:18:07 GMT References: <14411@oddjob.UChicago.EDU> Reply-To: ags@s.cc.purdue.edu.UUCP (Dave Seaman) Organization: Purdue University Lines: 42 In article <14411@oddjob.UChicago.EDU> vinson@oddjob.uchicago.edu (Michael Vinson) writes: >I am using Sun UNIX Pascal, and I have a problem that is annoying in >the extreme. The problem is as simple as it is absurd: when I try to >compile a program that read a string (i.e. a packed array of char) from >a text (yes text) file, the compiler tells me "Can't read strings from >a text file"!!! This is crazy. It means, for example the the following >lines won't work: [code deleted] That is correct. Reading strings from a text file is not allowed in standard Pascal. Many implementations provide a way to do it, but it is not part of the standard. >This is a pain in the *ss! Does anyone have any ideas/solutions/remedies? Sure. Write a short procedure to do what you want, and call it as needed, or use a language/implementation that supports string input directly. >(I mean, I can always read in a string one char at a time, but I shouldn't >have to. If you can't read strings from a text file, which includes standard >input, what can you read them from?) You can read strings from a file of strings. type string = packed array [1..80] of char; var f : file of string; str : string; begin reset(f); read(f,str); . . . -- Dave Seaman ags@j.cc.purdue.edu