Computer Science Canada

change save to disk directory

Author:  guttface [ Tue Feb 10, 2004 9:44 pm ]
Post subject:  change save to disk directory

hey. i'm making a game which saves high scores to a file using
code:
  open : streamNumber,filename, put
how do i control where the file gets created?

Author:  Dan [ Tue Feb 10, 2004 10:45 pm ]
Post subject: 

for the file name u can put in a dir as well like:

"C:\\compscifiles\\dan\\myfile.ai"

note the \\ is need to relpace a noraml / in a dir line

Author:  AsianSensation [ Tue Feb 10, 2004 10:48 pm ]
Post subject: 

code:
var fileout : int
open : fileout, "highscore.txt", put


when you are doing something like that, you can specify the string and add the path to specifiy where you want the file to be created. (I think, not sure which slash was it)

code:
var fileout : int
open : fileout, "C://My Documents//highscore.txt", put

Author:  Delos [ Wed Feb 11, 2004 2:35 pm ]
Post subject: 

Or, you could go the Dir way:

code:

var file : int
var dirName : string := "C:\\Turing\\Programmes\\Game\\Score\\"

Dir.Change (dirName)

open : file, "highScore.txt", put
% Everything in here.
close : file


Author:  guttface [ Wed Feb 11, 2004 6:50 pm ]
Post subject: 

Its a double backspace "\\" . How do you get the directory of the curently running file?

Author:  Delos [ Wed Feb 11, 2004 7:50 pm ]
Post subject: 

Dir.Current


: