Computer Science Canada Input Output help? |
Author: | m84uily [ Wed Mar 11, 2009 12:01 pm ] | ||||
Post subject: | Input Output help? | ||||
What I'm attempting to do here is get numbers from files A.txt and B.txt and put them into C.txt, however I'm having trouble with the get part. I followed the guide : http://compsci.ca/v3/viewtopic.php?t=12972 And I do realize that I'm using a different array than the one in the tutorial, although I'm quite sure it works as another person in my class used it with success.
The problem is on the line:
I get the error "illegal get item". Could someone explain to me why this is happening and how I can fix it? Thanks in advance. |
Author: | DemonWasp [ Wed Mar 11, 2009 12:07 pm ] | ||
Post subject: | RE:Input Output help? | ||
You're missing the colon between get and streamA. You want this instead:
|
Author: | m84uily [ Wed Mar 11, 2009 12:09 pm ] | ||
Post subject: | Re: RE:Input Output help? | ||
DemonWasp @ Wed Mar 11, 2009 12:07 pm wrote: You're missing the colon between get and streamA. You want this instead:
Thanks! But it still gives me the same error ![]() |
Author: | DemonWasp [ Wed Mar 11, 2009 12:22 pm ] | ||
Post subject: | RE:Input Output help? | ||
Ah, yes...and you also need to specify an element of the array. You can't just get an array, you have to get the strings that compose the array. Specifically:
etcetera. |
Author: | m84uily [ Wed Mar 11, 2009 12:26 pm ] | ||
Post subject: | Re: RE:Input Output help? | ||
DemonWasp @ Wed Mar 11, 2009 12:22 pm wrote: Ah, yes...and you also need to specify an element of the array. You can't just get an array, you have to get the strings that compose the array. Specifically:
etcetera. Thanks, but, is there any way to get them all at once? I could definitely work with this, though. |
Author: | TheGuardian001 [ Wed Mar 11, 2009 2:02 pm ] | ||
Post subject: | Re: Input Output help? | ||
Yes, you can use a for statement to repeat the process for however many elements you have in your array.
|
Author: | andrew. [ Wed Mar 11, 2009 3:47 pm ] | ||
Post subject: | RE:Input Output help? | ||
Use "upper (arrayName)" to find the highest index you have (the number of elements). So, it would be like:
Just change arrayName to the name of your array. |