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

Username:   Password: 
 RegisterRegister   
 Saving / Loading Files
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
recneps




PostPosted: Sat Jan 17, 2004 8:44 pm   Post subject: Saving / Loading Files

Question about saving/loading to/from files. can the filename be anything? like .file or .mai (©Mazer 2004 Razz) and ina paint prog made in turing (or just a screenshot of the screen...) can you save pic files?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Jan 17, 2004 8:51 pm   Post subject: (No subject)

extensions are just used by filesystem to assosiate file with an application to which it belongs. You can name your file whatever you want.

and yes, you can save area of your exectuion window as a screenshot. It's Pic.something... not sure Confused
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
recneps




PostPosted: Sat Jan 17, 2004 9:36 pm   Post subject: (No subject)

cool, thanks, so mazer really can make .mai o.O lol
DanShadow




PostPosted: Sat Jan 17, 2004 9:41 pm   Post subject: (No subject)

ok...before asking us, at least try to check the help ON please. So you want to "save" a "pic"...search in help: "Pic.Save"..pumps you up with this:
Loading:
code:

var mypic:int:=Pic.FileNew("mypic.bmp")
var x,y:int:=200
Pic.Draw(mypic,x,y,picMerge)

Saving:
code:

% Saves a piccture as "mypic.bmp"
var picID: int
var x, y : int
Draw.FillBox (50, 50, 150, 150, red)
Draw.FillStar (50, 50, 150, 150, green)
Draw.FillOval (100, 100, 50, 50, blue)
picID := Pic.New (50, 50, 150, 150)
Pic.Save (picID, "mypic.bmp")
Pic.Free (picID)


See...right out of the help file. Razz
recneps




PostPosted: Sat Jan 17, 2004 9:44 pm   Post subject: (No subject)

thanks, lol i dont even know how to save/load files, i was just wondering if you could use any extension, etc Smile since i might make hangman or something that has all the words in a file, but noone will know they;re there because its like .jfsdhglsku lol
DanShadow




PostPosted: Sat Jan 17, 2004 9:58 pm   Post subject: (No subject)

I dont qu ite understand what your say ing, but you seem to be asking how to load text files or something, so here:
Loading:
code:

var database,highscores:int
open:datafile,filename:get
get:datafile,highscores
highscores:=highscores
close:datafile
put "High Score: ",highscores

Saving:
code:

var datafile,highscores:int
open:datafile,filename:put
put:datafile,highscores
close:datafile

Excuse me if there is a couple syntax errors...but you should get the points. Hope this helps.
recneps




PostPosted: Sun Jan 18, 2004 4:15 pm   Post subject: (No subject)

i was saying like i had 5 variables and i wanted to know if i could choose the extension of the file they were saved as, like save to (whatever the code is) files.rec rather than a .txt or .dat, etc, and the answer was yes Smile
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  [ 7 Posts ]
Jump to:   


Style:  
Search: