Computer Science Canada Reading a data file line with a space in it |
Author: | Bman54 [ Thu Nov 12, 2009 11:15 am ] | ||
Post subject: | Reading a data file line with a space in it | ||
What is it you are trying to achieve? I'm trying to make a quiz game and some my answers and questions are in a data file, but if I try to read a line that has a space in it, it only read the first word and then reads the next word as a separate line. What is the problem you are having? How can I make it so it read the whole line and stores in one variable instead of separate ones? Describe what you have tried to solve this problem I have no idea how to solve this. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) This is what I've got to read it normally.
And this is my data file: Ontario Toronto Quebec Quebec City Manitoba Winnipeg Prince Edward Island Charlottetown New Brunswick Fredericton British Columbia Victoria Alberta Edmonton Saskatchewan Regina Nunavut Iqaluit Newfoundland and Labrador St. John's Nova Scotia Halifax Yukon Whitehorse Northwest Territories Yellowknife (I'm doing a Province/Capital quiz game) Please specify what version of Turing you are using This is on Turing 4.0.3 Also, the code I have is not really my quiz game yet. I'm starting off like this so I understand how to read a data file properly when I really get to making the quiz. |
Author: | Tony [ Thu Nov 12, 2009 12:06 pm ] | ||
Post subject: | Re: Reading a data file line with a space in it | ||
Read the documentation on -- get In particular
|
Author: | Kharybdis [ Thu Nov 12, 2009 3:01 pm ] |
Post subject: | RE:Reading a data file line with a space in it |
ah tony, you're too fast! |
Author: | Tony [ Thu Nov 12, 2009 3:12 pm ] |
Post subject: | RE:Reading a data file line with a space in it |
I'm sorry ![]() |
Author: | Bman54 [ Fri Nov 13, 2009 11:07 am ] |
Post subject: | RE:Reading a data file line with a space in it |
Thanks for the help! |