Mail Archives: djgpp/1998/02/07/06:16:16
"Matt Kris" (jdkris AT NOPOOPalpha DOT delta DOT edu) writes:
> I need to make a function that will open a text file that contains a list of
> 100 words and take a randon word and store it in an array. I made a
> function that will open the file and read the first word but I don't know
> how to read the other lines. Is there a way to move through files like
> that? Please help.
Easy. Obtain a random number r from 0 to 99. Open the file. Then for (i=0;
i<r; i++) { read a line and discard it using an appropriate file input
command }, then read a line and use that as the name.
--
.*. Friendship, companionship, love, and having fun are the reasons for
-() < life. All else; sex, money, fame, etc.; are just to get/express these.
`*' Send any and all mail with attachments to the hotmail address please.
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca pgd73 AT hotmail DOT com
- Raw text -