Computer Science Canada

load/save

Author:  shadowNET [ Mon Mar 19, 2012 4:31 pm ]
Post subject:  load/save

What is it you are trying to achieve?
I am trying to make a game and have the ability to save files/load files


What is the problem you are having?
I dont know how to save text such as the variavle values and call on them later when loading


Describe what you have tried to solve this problem
I have looked up commands and similar things and attempted to use them but have had little success

Please specify what version of Turing you are using
4.1.1

Author:  Fexter [ Mon Mar 19, 2012 4:48 pm ]
Post subject:  Re: load/save

Try checking 'open' in the Turing documentation. That's the basic code you need for this.

For reading from the file, you want to use:

var f1 : int
var yourVar : yourVarType

open : f1, fileName, read % Open the file, so that it can be read from

read : f1,yourVar % Store the contents in the variable 'yourVar'

close : f1

And to write to it, use:

var f1 : int % A variable to use for opening the file; this will hold the file contents for writing
var yourVar : yourVarType % The variable you want to save

open : f1, fileName, write % Open the file

write : f1, yourVar % Write to the file

close : f1 % Close the file[/b]

Author:  evildaddy911 [ Thu Mar 22, 2012 4:07 pm ]
Post subject:  Re: load/save

your going to want to start off using get and put instead of read and write, but yeah thats the basics. click here for more information


: