Newbie need help
Author |
Message |
ssikmace
|
Posted: Wed Mar 31, 2004 8:53 pm Post subject: Newbie need help |
|
|
Hello, im trying to define an array using words read from a file but i don't really know how, this is my best guess so far. Thx
var search : string
var streamin : int
var word : string
var itemcount : int
open : streamin, "Drawer.txt", get
assert streamin > 0
itemcount := 0
loop
get : streamin, skip
exit when eof (streamin)
get : streamin, word
itemcount := itemcount + 1
end loop
put itemcount
var items : array 1..itemcount of string
for i:1..itemcount
get streamin, items (i)
end for
for i:1..itemcount
put items(i)
end for |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Wed Mar 31, 2004 8:56 pm Post subject: (No subject) |
|
|
eh... well you're missing the colon in your 2nd get.
and you should close and reopen the file to start reading from the beginning again after you finished counting.
I'd tell you to just use a flexable array and have a single loop instead, but that might be a bit too advanced... |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
ssikmace
|
Posted: Wed Mar 31, 2004 8:57 pm Post subject: (No subject) |
|
|
lol thx its always something simple. |
|
|
|
|
|
|
|