Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!pasteur!ucbvax!hplabs!sdcrdcf!csun!csuna!abcscnuk From: abcscnuk@csuna.UUCP (Naoto Kimura) Newsgroups: comp.lang.pascal Subject: Re: Sun Pascal bug? Message-ID: <1085@csuna.UUCP> Date: 26 Feb 88 17:26:23 GMT References: <14411@oddjob.UChicago.EDU> Reply-To: abcscnuk@csuna.UUCP (Naoto Kimura) Organization: California State University, Northridge Lines: 47 Summary: Nope, it isn't a bug 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: There's nothing wrong with your compiler. You can't read strings from a text file. >... >This is a pain in the *ss! Does anyone have any ideas/solutions/remedies? >(I mean, I can always read in a string one char at a time, but I shouldn't >have to. But you have to... in standard pascal that is >If you can't read strings from a text file, which includes standard >input, what can you read them from?) > >Michael Vinson You *might* be able to read strings (declared as packed array of char) from a file of the string type, though you might get some pretty weird stuff if the file is not of a fixed-format type. You should also make sure that you use "flush" (if there is such a procedure in the pascal you use) after using a "write" to output your prompt, otherwise your prompt may not appear before it waits for input. What's really fun is when your prompt appears in the middle of typing your response (this happens with the Berkeley compliler "pc" when you forget to use "flush" after writing out the prompt. If you use writeln, usually there is no problem). You may still get some problems, especially if you use "eof" or "eoln" before your write, because the computer will wait for a character (to check for eof or eoln) then do the write, sometimes, the implicit get at the beginning will cause this strange behavior. There aren't any problems like this when you run the program as a batch job. //-n-\\ Naoto Kimura _____---=======---_____ (csun!csuna!abcscnuk) ====____\ /.. ..\ /____==== // ---\__O__/--- \\ Enterprise... Surrender or we'll \_\ /_/ send back your *&^$% tribbles !! P.S.: If you ever wonder why eoln and eof exist, try using a CDC. Eoln is signaled by two zero bytes aligned at a word boundary. A zero byte happens to be a colon character.