Computer Science Canada I/O Problems |
Author: | Sauvus [ Wed May 09, 2012 4:10 pm ] | ||
Post subject: | I/O Problems | ||
What is it you are trying to achieve? A relevant answer to the problem of Loading up I/O's. What is the problem you are having? The I/O saves, but i have no idea how to load Describe what you have tried to solve this problem I tried using get, but for some reason every time i tried to put it in the right position, it failed.
Please specify what version of Turing you are using The Latest |
Author: | Tony [ Wed May 09, 2012 4:18 pm ] |
Post subject: | RE:I/O Problems |
- in what way does it fail? - you're not actually using "get" in your provided code. |
Author: | Sauvus [ Wed May 09, 2012 4:21 pm ] |
Post subject: | RE:I/O Problems |
Okay, sorry. I should've explained more efficiently. 1. It overwrites due to var player1x2 : int := 26 var player1y2 : int := 51 But, if these dont have values, the code doesn't work. I've erased get because of the fact that it wasn't probably placed correctly, and i've tried to use it. |
Author: | Sauvus [ Wed May 09, 2012 9:47 pm ] |
Post subject: | RE:I/O Problems |
I feel as though my question is valid, so if anyone could help please leave a reply. |
Author: | Tony [ Wed May 09, 2012 10:58 pm ] |
Post subject: | RE:I/O Problems |
I have trouble figuring out what your question is, and you are not using a question mark to help me guess at what you are asking. |
Author: | Sauvus [ Wed May 09, 2012 11:13 pm ] |
Post subject: | RE:I/O Problems |
Okay, when player1 moves up his y location is saved in a .txt file, but every time the program is rebooted, it is written over with the variable player1y2. The problem is that when these lines are called put : stream, player1x2 put : stream, player1y2 they require a value. I want it to read player1x2 and player1y2 from the text file and use it when it runs, but i'm not sure how i would use get in it. I've tried to properly put in a get function somewhere but it just doesn't help. |
Author: | Tony [ Thu May 10, 2012 2:07 am ] |
Post subject: | RE:I/O Problems |
What would you expect to write to file if player1y could have no value? The "problem" is that files are openned at the beginning, so you overwrite content. See docs for get on reading from file first. |
Author: | evildaddy911 [ Thu May 10, 2012 3:47 pm ] | ||
Post subject: | Re: I/O Problems | ||
do you see a problem with that? i do |
Author: | Sauvus [ Thu May 10, 2012 5:35 pm ] |
Post subject: | RE:I/O Problems |
I fixed it! Thanks for the help Tony. |