This wiki is out of date, use the continuation of this wiki instead

Save

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 10:27, 23 May 2008 (edit)
85.144.194.29 (Talk)
(New article.)
← Previous diff
Current revision (20:48, 23 May 2008) (edit) (undo)
Sandman (Talk | contribs)
m
 
Line 5: Line 5:
'''INT''' save ( <'''STRING''' filename> , <'''VARSPACE''' data> ) '''INT''' save ( <'''STRING''' filename> , <'''VARSPACE''' data> )
-Saves the data from any variable to the specified file.+Saves the data from the specified variable to the specified file.
== Parameters == == Parameters ==
Line 20: Line 20:
Attempting to use "?","*","<",">" or "|" in a filename will result in no file at all on Windows, while using ":" in a filename results in everything from the ":" and beyond being cut off from the file name and the resulting file will be of size 0. Attempting to use "?","*","<",">" or "|" in a filename will result in no file at all on Windows, while using ":" in a filename results in everything from the ":" and beyond being cut off from the file name and the resulting file will be of size 0.
-Using the characters "/" or "\" in the filename (without directories that can be accesssed that way) results in everything from this character and before being cut off from the filename. The file will be saved successfully nontheless.+Using the characters "/" or "\" in the filename (without directories that can be accessed that way) results in everything from this character and before being cut off from the filename. The file will be saved successfully nonetheless.
== Example == == Example ==
Line 34: Line 34:
Write(0,10,10,0,"Data saved!"); Write(0,10,10,0,"Data saved!");
- While (!key(_esc))+ While (!key(_ESC))
Frame; Frame;
End End
End End
</pre> </pre>
-Used in example: [[write]](), [[key]]()+Used in example: [[save]](), [[write]](), [[key]]()
 + 
 +{{Funcbox
 + | category = Files
 +}}

Current revision


Contents

[edit] Definition

INT save ( <STRING filename> , <VARSPACE data> )

Saves the data from the specified variable to the specified file.

[edit] Parameters

STRING filename - The name of the file that will be saved.
VARSPACE data - The variable (of any datatype) that will be saved in a file.

[edit] Returns

INT : The number of bytes written to the file.

[edit] Notes

Attempting to use "?","*","<",">" or "|" in a filename will result in no file at all on Windows, while using ":" in a filename results in everything from the ":" and beyond being cut off from the file name and the resulting file will be of size 0.

Using the characters "/" or "\" in the filename (without directories that can be accessed that way) results in everything from this character and before being cut off from the filename. The file will be saved successfully nonetheless.

[edit] Example

Program test;
Global
    struct My_struct
        Level_number="99";
        string Map_name="Amazing map";
    End
Begin
        Save("myfile.sav",My_struct); // The content of My_struct is saved in myfile.sav
        Write(0,10,10,0,"Data saved!");

    While (!key(_ESC))
        Frame;
    End
End

Used in example: save(), write(), key()


Files Functions
Cd() • Chdir() • Fclose() • Feof() • Fgets() • File() • File_exists() • Flength() • Fopen() • Fputs() • Fread() • Fseek() • Ftell() • Fwrite() • Glob() • Load() • Mkdir() • Rmdir() • Save() •
Personal tools