Get your own free workspace
View
 

OpenFile

Page history last edited by Gamemaster 3 years, 9 months ago

 

 

OpenFile

Usage:

                OpenFile(Name)

Description:

The OpenFile command opens a file for random access, and returns a handle to it for use with the file reading/writing commands. All files are stored in the Data\Server Data\Script Files\ folder. Make sure to call CloseFile after you are finished with the file, to prevent memory leaks.

Name is the filename (e.g. "Data" or "MyFile.txt").

Example:

                Function Main()
                        F = OpenFile("Test.txt")
                                // Read in current first line and display to user
                                FileData = ReadLine(F)
                                Output(Actor(), FileData)
                                // Return to the beginning of the file and write a new line
                                SeekFile(F, 0)
                                WriteLine(F, "This text will be readable in Notepad")
                        CloseFile(F)
                        Return()

                End Function

Comments (0)

You don't have permission to comment on this page.