Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
FileIO API

Typedefs

typedef int[] ParseHandle
 
typedef int[] FileHandle
 
typedef int[] FindFileHandle
 

Enumerations

enum  FileMode { READ, WRITE, APPEND }
 
enum  FileAttr { DIRECTORY, HIDDEN, READONLY, INVALID }
 
enum  FindFileFlags
 

Functions

proto native ParseHandle BeginParse (string filename)
 
proto int ParseLine (ParseHandle tp, int num, string tokens[])
 
proto native void EndParse (ParseHandle file)
 
proto bool FileExist (string name)
 Check existence of file. More...
 
proto FileHandle OpenFile (string name, FileMode mode)
 Opens File. More...
 
proto int ReadFile (FileHandle file, void param_array, int length)
 
proto void CloseFile (FileHandle file)
 Close the File. More...
 
proto void FPrint (FileHandle file, void var)
 Write to file. More...
 
proto void FPrintln (FileHandle file, void var)
 Write to file and add new line. More...
 
proto int FGets (FileHandle file, string var)
 Get line from file, every next call of this function returns next line. More...
 
enum FindFileFlags FindFile (string pattern, out string fileName, out FileAttr fileAttributes, FindFileFlags flags)
 
proto bool FindNextFile (FindFileHandle handle, out string fileName, out FileAttr fileAttributes)
 
proto native void CloseFindFile (FindFileHandle handle)
 
proto native bool MakeDirectory (string name)
 Makes a directory. More...
 
proto native bool DeleteFile (string name)
 delete file. Works only on "$profile:" and "$saves:" locations More...
 
proto native bool CopyFile (string sourceName, string destName)
 copy file. destName must be "$profile:" or "$saves:" location More...
 

Detailed Description

Typedef Documentation

◆ FileHandle

typedef int [] FileHandle

Definition at line 390 of file ensystem.c.

◆ FindFileHandle

typedef int [] FindFileHandle

Definition at line 503 of file ensystem.c.

◆ ParseHandle

typedef int [] ParseHandle

Definition at line 389 of file ensystem.c.

Enumeration Type Documentation

◆ FileAttr

enum FileAttr
Enumerator
DIRECTORY 

File is directory.

HIDDEN 

File is hidden.

READONLY 

File is read-only.

INVALID 

Invalid file.

Definition at line 505 of file ensystem.c.

◆ FileMode

enum FileMode
Enumerator
READ 
WRITE 
APPEND 

Definition at line 382 of file ensystem.c.

◆ FindFileFlags

Definition at line 513 of file ensystem.c.

Function Documentation

◆ BeginParse()

proto native ParseHandle BeginParse ( string  filename)

◆ CloseFile()

proto void CloseFile ( FileHandle  file)

Close the File.

Parameters
fileFile handle ID of a opened file
Returns
void
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
if (file != 0)
{
FPrintln(file, "line1");
FPrintln(file, "line2");
FPrintln(file, "line3");
CloseFile(file);
}

◆ CloseFindFile()

proto native void CloseFindFile ( FindFileHandle  handle)

◆ CopyFile()

proto native bool CopyFile ( string  sourceName,
string  destName 
)

copy file. destName must be "$profile:" or "$saves:" location

◆ DeleteFile()

proto native bool DeleteFile ( string  name)

delete file. Works only on "$profile:" and "$saves:" locations

◆ EndParse()

proto native void EndParse ( ParseHandle  file)

◆ FGets()

proto int FGets ( FileHandle  file,
string  var 
)

Get line from file, every next call of this function returns next line.

Parameters
fileFile handle ID of a opened file
varValue to write
Returns
int Count of chars or -1 if is not any for read (end of file is EMPTY line)
usage :
FileHandle file_handle = OpenFile("$profile:testiik.txt", FileMode.READ);
string line_content;
while ( FGets( file_handle, line_content ) > 0 )
{
Print(line_content);
}
CloseFile(file_handle);

◆ FileExist()

proto bool FileExist ( string  name)

Check existence of file.

◆ FindFile()

enum FindFileFlags FindFile ( string  pattern,
out string  fileName,
out FileAttr  fileAttributes,
FindFileFlags  flags 
)

◆ FindNextFile()

proto bool FindNextFile ( FindFileHandle  handle,
out string  fileName,
out FileAttr  fileAttributes 
)

◆ FPrint()

proto void FPrint ( FileHandle  file,
void  var 
)

Write to file.

Parameters
fileFile handle ID of a opened file
varValue to write
Returns
void
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
if (file != 0)
{
FPrint(file, "A");
FPrint(file, "B");
FPrint(file, "C");
CloseFile(file);
}

◆ FPrintln()

proto void FPrintln ( FileHandle  file,
void  var 
)

Write to file and add new line.

Parameters
fileFile handle ID of a opened file
varValue to write
Returns
void
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
if (file != 0)
{
FPrintln(file, "line1");
FPrintln(file, "line2");
FPrintln(file, "line3");
CloseFile(file);
}

◆ MakeDirectory()

proto native bool MakeDirectory ( string  name)

Makes a directory.

◆ OpenFile()

proto FileHandle OpenFile ( string  name,
FileMode  mode 
)

Opens File.

Parameters
nameof a file to open, (you can use filesystem prefixes ('$profile','$saves','$mission'). For accessing profile dir use '$profile', e.g. '$profile:myfilename.txt')
modeconstants FileMode.WRITE, FileMode.READ or FileMode.APPEND flag can be used
Returns
file handle ID or 0 if fails
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
//FileHandle file = OpenFile("$profile:testiik.txt", FileMode.APPEND);
if (file != 0)
{
FPrintln(file, "line1");
FPrintln(file, "line2");
FPrintln(file, "line3");
CloseFile(file);
}

◆ ParseLine()

proto int ParseLine ( ParseHandle  tp,
int  num,
string  tokens[] 
)

◆ ReadFile()

proto int ReadFile ( FileHandle  file,
void  param_array,
int  length 
)

Reads raw data from file.

Parameters
param_arrayReceiving array for the data. Valid types are int[] or string
lengthLength of data
Returns
number of read bytes
FPrintln
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.
CloseFile
proto void CloseFile(FileHandle file)
Close the File.
OpenFile
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
FPrint
proto void FPrint(FileHandle file, void var)
Write to file.
Print
proto void Print(void var)
Prints content of variable to console/log.
FileMode
FileMode
Definition: ensystem.c:382
FGets
proto int FGets(FileHandle file, string var)
Get line from file, every next call of this function returns next line.
FileHandle
int[] FileHandle
Definition: ensystem.c:390