
-----------------------------------
recneps
Sat Jan 17, 2004 8:44 pm

Saving / Loading Files
-----------------------------------
Question about saving/loading to/from files. can the filename be anything? like .file or .mai (Â©Mazer 2004 :P) and ina  paint prog made in turing (or just a screenshot of the screen...) can you save pic files?

-----------------------------------
Tony
Sat Jan 17, 2004 8:51 pm


-----------------------------------
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 :?

-----------------------------------
recneps
Sat Jan 17, 2004 9:36 pm


-----------------------------------
cool, thanks, so mazer really can make .mai o.O lol

-----------------------------------
DanShadow
Sat Jan 17, 2004 9:41 pm


-----------------------------------
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: 

var mypic:int:=Pic.FileNew("mypic.bmp")
var x,y:int:=200
Pic.Draw(mypic,x,y,picMerge)

Saving:

% 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.  :P

-----------------------------------
recneps
Sat Jan 17, 2004 9:44 pm


-----------------------------------
thanks, lol i dont even know how to save/load files, i was just wondering if you could use any extension, etc :) 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
Sat Jan 17, 2004 9:58 pm


-----------------------------------
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:

var database,highscores:int
open:datafile,filename:get
get:datafile,highscores
highscores:=highscores
close:datafile
put "High Score: ",highscores

Saving:

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
Sun Jan 18, 2004 4:15 pm


-----------------------------------
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 :)
