Garry's Mod Wiki

File

You might be looking for the "file" Library, which has the same name as this class.

This is the file object. It used used primarily to read or write binary data from files.

The object is returned by file.Open.

Methods

File:Close()
Dumps the file changes to disk and closes the file handle which makes the handle useless.
boolean File:EndOfFile()
Returns whether the File object has reached the end of file or not.
File:Flush()
Dumps the file changes to disk and saves the file.
string File:Read( number length )
Reads the specified amount of chars and returns them as a binary string.
boolean File:ReadBool()
Reads one byte of the file and returns whether that byte was not 0.
number File:ReadByte()
Reads one unsigned 8-bit integer from the file.
number File:ReadDouble()
Reads 8 bytes from the file converts them to a double and returns them.
number File:ReadFloat()
Reads 4 bytes from the file converts them to a float and returns them.
string File:ReadLine()
Returns the contents of the file from the current position up until the end of the current line. This function will look specifically for Line Feed characters \n and will completely ignore Carriage Return characters \r.This function will not return more than 8192 characters.
number File:ReadLong()
Reads a signed 32-bit integer from the file.
number File:ReadShort()
Reads a signed 16-bit integer from the file.
number File:ReadULong()
Reads a unsigned 32-bit integer from the file.
number File:ReadUShort()
Reads a unsigned 16-bit integer from the file.
File:Seek( number pos )
Sets the file pointer to the specified position.
number File:Size()
Returns the size of the file in bytes.
number File:Skip( number amount )
Moves the file pointer by the specified amount of chars.
number File:Tell()
Returns the current position of the file pointer.
File:Write( string data )
Writes the given string into the file.
File:WriteBool( boolean bool )
Writes a boolean value to the file as one byte.
File:WriteByte( number uint8 )
Write an 8-bit unsigned integer to the file.
File:WriteDouble( number double )
Writes a 8byte floating point double to the file.
File:WriteFloat( number float )
Writes a 4byte float to the file.
File:WriteLong( number int32 )
Writes a 32-bit signed integer to the file.
File:WriteShort( number int16 )
Writes a 16-bit signed integer to the file.
File:WriteULong( number uint32 )
Writes an unsigned 32-bit integer to the file.
File:WriteUShort( number uint16 )
Writes an unsigned 16-bit integer to the file.

Page Links


Special Pages


Wikis

?

Render Time: 38ms

DB GetPage 5
Generate Html 3
SaveChanges (1) 14
Render Body 0
Render Sidebar 12