[fpc-pascal]opening files from a text list

DONALD PEDDER jims_son at jedi.apana.org.au
Mon Dec 22 19:37:33 CET 2003

   Firstly, my current challenge, and then some responses to some other
comments that were made.

> > replace result:= by scanblack:=
>    That was the missing piece of the puzzle. Thank you (and to Anton
> too)!

   I've started actually writing my code now (I have a very busy life, so
it sometimes takes a while to get back to things), and I am having issues
in reading numbers. e.g. "49ers at Giants 16 13" (I know I didn't mention
this to begin with, but I didn't think reading the score would be an
issue, and it is).
   When I've read everything up to the score (using scanblack/scanwhite),
and then do "read(line,awayscore)" the program hangs (using read now, as I
want to read the number and not a word). Experimentation showed me it was
waiting for standard input, even though I've specified to read from the
line I have scanned in. :-\
   I know the result of scanblack is a string and not a number, so would I
modify it to (hopefully) also read in numbers? Can I make it do both, or
would I perhaps write another function to read numbers? I don't know if
the latter would work, given that "read(line,...." isn't working.

> What happens if the "Mighty Ducks" or the "White Sox"--or my favorite,
> "Eat at Joe's" play?

   Not an issue as the only person who'll be using this program is me. :-)
The input format is totally determined by me, and the code written
accordingly (the input format is often even chosen to make the code

> @Donald: There ARE problems when reading numbers, e. g. "1000.0" is
> sometimes written as "1000,0", "1'000.0", "1,000.00" or even
> "1,000.--".

   Right, yet Pascal implements reading numbers as long as it is digits
only. If you don't have digits only, then you know you'll have to write
extra code to cope (perhaps reformatting the file first before processing,
which is what I do with some of my stuff).
   Why not have a similar approach with reading words? A word is either
something that is entirely a-z,A-Z, or anything space-delimited. Anything
outside of that case (whichever approach is taken), just like with numbers
with non-digits in them, you write extra code, but at least when the
format allows it you have an easy way to read words (something which I now
have with this scanblack code, which makes life much easier than it was
:-) ).


E-mail               - donaldp at au.mensa.org
BIG DON's Home-page  - http://jedi.apana.org.au/~jims_son
Pedder Passer Rating - http://jedi.apana.org.au/~jims_son/PPR
AusNFL mailing-list  - http://jedi.apana.org.au/mailman/listinfo/ausnfl

"What I always wanted is to be accepted, not understood" - MAN RAY

More information about the fpc-pascal mailing list