[fpc-pascal]opening files from a text list

DONALD PEDDER jims_son at jedi.apana.org.au
Fri Nov 28 02:30:46 CET 2003

   As per my last question to the list, I'm sure there's a way to do this,
but I'm not sure how. Last time I got a quick answer after I'd spent ages
trying to work it out myself, so I'll ask first this time, instead of
banging my head against the keyboard. :-)

   I'll use the actual example I am working on, which relates to football

   If I have a file which contains on the first line...

49ers at Giants 16 13

   I want to open a file called "49ers" and a file called "Giants" and do
some processing. Although FP handles strings, I believe that you can still
only read a character at a time, so I don't know how to read "49ers" into
a variable and open that file. The variable would be called Away say, so
how do I get "49ers" into Away so that I can then do
assign(awayteam,Away)? I would then want to read "Giants" into Home, and
do assign(hometeam,Home), and go from there.
   Some teams have the same initial, so just reading the first character
fails to provide enough uniqueness. I know I could set up a complex set of
embedded case statements (case first char -> case second char), but
there's surely an easier way? That method would leave the team names
hard-coded into the program, which isn't a very good way to do things.


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