Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 File IO issues, probably a beginner / intermediate level issue
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mundane_Ostrich




PostPosted: 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.



Test File Writer.t
 Description:
Don't flame me, I char easily! D:

Download
 Filename:  Test File Writer.t
 Filesize:  2.21 KB
 Downloaded:  126 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: 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




PostPosted: 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




PostPosted: 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


Test File Writer.t
 Description:
Something to make drawing much easier.
(stahp with teh art assignments... seriously)

Download
 Filename:  Test File Writer.t
 Filesize:  12.05 KB
 Downloaded:  102 Time(s)

Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: