Computer Science Canada Reading .txt files |
Author: | Chris [ Thu Feb 16, 2006 8:28 pm ] | ||
Post subject: | Reading .txt files | ||
Im writing a programing challenge in a couple weeks that requires file input. Here is what I have gathered so far:
This works, but I need multiple words to be stored. If you could, I would like to know how to store each word individually (in an array) in one long string. Thanks in advance, and I know you guys wont respond with "read the help" because your all so helpful and nice ![]() Thanks again for any help. |
Author: | Cervantes [ Thu Feb 16, 2006 8:35 pm ] | ||
Post subject: | Re: Reading .txt files | ||
Chris wrote: Thanks in advance, and I know you guys wont respond with "read the help" because your all so helpful and nice
![]() Of course not... Read the Turing Walkthrough. ![]() Just kidding. You'll need to learn to use a Flexible Array. With each word you get, add a new element to your flexible array, assigned that new element to the value gotten. However, we can optimize this. Rather than getting each word into a temporary variable and assigned that to the new, upper element of the flex. array, we can get the word directly into the upper element of the flex array. For example,
|