File IO issues, probably a beginner / intermediate level issue
Author |
Message |
Mundane_Ostrich
|
Posted: Wed Feb 10, 2016 3:44 am Post subject: File IO issues, probably a beginner / intermediate level issue |
|
|
What is it you are trying to achieve?
I'm trying to make Turing write something, that something is Turing.
(As to answer why anyone would want to do this, I was given an art assignment. Writing in all the numbers feels tedious and completely boring. I understand that this is kind of like swatting a fly with an actual swat team but at least it's interesting.)
What is the problem you are having?
As crazy as it already is, the issue I'm having with actually deals with the saving portion of it.
Turing just overwrites everything every time I use put (I'm not using write because it fills an entire line with " "(aprox. 260) making it too long for a string.)
What I want to do is to make it so that it:
- Doesn't overwrite previous information
- Can actually go to a 2nd line after closing and opening a file
Describe what you have tried to solve this problem
Seek and Tell follow byte positions and not lines, I've tried.
I'm thinking about making it so that I can use seek/tell by setting spaces after a set of variables then "export"ing that into a Turing script.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please don't flame me if it's terrible programming, I'm not a master of Turing.
Please specify what version of Turing you are using
4.12 but I also want it to work on the 3.0 versions as well.
Description: |
Don't flame me, I char easily! D: |
|
Download |
Filename: |
Test File Writer.t |
Filesize: |
2.21 KB |
Downloaded: |
131 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Wed Feb 10, 2016 5:51 am Post subject: RE:File IO issues, probably a beginner / intermediate level issue |
|
|
The easiest way is probably to load the entire file into an array, make your changes to the array, and then write it all back to the file.
|
|
|
|
|
|
Mundane_Ostrich
|
Posted: Thu Feb 11, 2016 12:54 am Post subject: Re: File IO issues, probably a beginner / intermediate level issue |
|
|
All those problems earlier were solved so I felt that it would be nice to just give a fixed version. Why not?
Keyboard Input
Important: When exiting please use ESC and to go to next frame press N
q = Primary colour change
a = Secondary colour change
Holding down shift switches between the 2.
Holding down alt will lock to a 25px grid
e = Draw.FillBox
r = Draw.Box
t = Draw.Line
d = Dots
f = Empty Dots
g = Line tool (Watch what happens when you left go of mouse)
z = Thickness of dots
x = Spray, higher num = crazier spray pattern
ToDo: Loading system
|
|
|
|
|
|
Mundane_Ostrich
|
Posted: Thu Feb 11, 2016 12:55 am Post subject: Re: File IO issues, probably a beginner / intermediate level issue |
|
|
Apparently I forgot to attached a file :l
Description: |
Something to make drawing much easier. (stahp with teh art assignments... seriously) |
|
Download |
Filename: |
Test File Writer.t |
Filesize: |
12.05 KB |
Downloaded: |
106 Time(s) |
|
|
|
|
|
|
|
|