Quality Software Solutions
  • Specializing in professional hex editor tools,
    including disk editing and process editing.





010 Editor - Hex Editor Homepage


The following is a list of input/output functions that can be used when writing Templates or Scripts.

void BigEndian()
Indicates that all subsequent reads and writes from the file should use big-endian byte order. This function can be used in a Template to specify the byte order of variables.

void BitfieldDisablePadding()
void BitfieldEnablePadding()
These functions control how multiple bitfields are packed into a set of bits. See Bitfields more information on bitfields. Padding is enabled by default.

void BitfieldLeftToRight()
void BitfieldRightToLeft()
These functions control how bitfields are packed into a variable. See Bitfields for an introduction to using bitfields. The packing is different depending on if the Template is in big or little endian mode. In little endian mode the default is right-to-left and in big endian mode the default is left-to-right.

void DeleteBytes( quad start, quad size )
Deletes size bytes from the file, starting at address start.

int DirectoryExists( string dir )
Returns true if the given directory exists on disk or false if it does not. dir should be the full path for a directory.

int FEof()
Returns true if the current read position is at the end of the file.

quad FileSize()
Returns the size of the current file in bytes.

TFileList FindFiles( string dir, string filter )
This function scans the given directory dir and returns all files that match the filter. The filter can contain the wildcard characters * and ? and can contain multiple filters separated by semi-colons (for example, "*.cpp;*.c;*.h"). The results are returned in a TFileList structure which has a filecount variable indicating the number of files that match the filter, and an array of file variables which each contain a string filename. The TFileList also contains a list of sub-directories in the given directory. The dircount variable indicates how many sub-directories exist and an array of dir variables contains a dirname string for each directory. For example:

    TFileList fl = FindFiles( "C:\\temp\\", "*.zip" );
    int i;
    Printf( "Num files = %d\n", fl.filecount );
    for( i = 0; i < fl.filecount; i++ )
    {
        Printf( " %s\n", fl.file[i].filename );
    }
    Printf( "\n" );
    Printf( "Num dirs = %d\n", fl.dircount );
    for( i = 0; i < fl.dircount; i++ )
    {
        Printf( " %s\n", fl.dir[i].dirname );
    }

int FPrintf( int fileNum, char format[], ... )
Performs a Printf starting from format and writes the resulting string to the file with index fileNum. Use the function GetFileNum to get the index of a file. The string is written at the current read/write position as given by FSeek and then the read/write position is moved forward. Use this function to read data from one file and write the results to another file. This function can also be used in a Template, but only on files that have been created with the FileNew function. See Printf for more information on format specifiers.

int FSeek( quad pos )
Sets the current read position to the address pos. The read position is used when defining variables in a Template. Using this function, bytes can be processed in any order. Returns 0 if successful or -1 if the address was out of range.

int FSkip( quad offset )
Moves the current read position ahead by offset bytes. offset can also be negative to move the read position backwards. The read position is used when defining variables in a template. Using this function, bytes can be processed in any order. Returns 0 if successful, or -1 if the address was out of range.

quad FTell()
Returns the current read position of the file. This read position is used when defining variables in a Template.

void InsertBytes( quad start, quad size )
Inserts size bytes into the file starting at address start. If start is at the end of the file, the file will be lengthened by size bytes. Note that this function, or any of the 'Write' functions can be used to lengthen a file.

int IsBigEndian()
Returns true if the file is being read in big-endian byte order, or false otherwise.

int IsLittleEndian()
Returns true if the file is being read in little-endian byte order, or false otherwise.

void LittleEndian()
Indicates that all subsequent reads and writes from the file should use little-endian byte order. This function can be used in a Template to specify the byte order of variables.

int MakeDir( string dir )
Attempts to create the directory given by dir. If any of the parent directories of the given directory do not exist, they will be created too. For example, MakeDir( "C:\\app\\data\\backup\\" ) will create the directories "C:\app\" and "C:\app\data\" if necessary. Returns true if the functions succeeds or false otherwise.

char ReadByte( quad pos )
double ReadDouble( quad pos )
float ReadFloat( quad pos )
int ReadInt( quad pos )
quad ReadQuad( quad pos )
short ReadShort( quad pos )
uchar ReadUByte( quad pos )
uint ReadUInt( quad pos )
uquad ReadUQuad( quad pos )
ushort ReadUShort( quad pos )
Returns data read from the file at address pos. These functions can be used in a Template to read data from a file without declaring a variable.

char[] ReadLine( quad pos )
Reads a string from the file starting at address pos. Reads characters until a null-character or end-of-line sequence is found.

void ReadBytes( uchar buffer[], quad pos, int n )
Reads n bytes starting from the address pos into the character array buffer. Note that char[] and uchar[] can be used interchangeably.

char[] ReadString( quad pos )
Reads a string from the file starting at address pos. Reads characters until a null-character is found.

void WriteByte( quad pos, char value )
void WriteDouble( quad pos, double value )
void WriteFloat( quad pos, float value )
void WriteInt( quad pos, int value )
void WriteQuad( quad pos, quad value )
void WriteShort( quad pos, short value )
void WriteUByte( quad pos, uchar value )
void WriteUInt( quad pos, uint value )
void WriteUQuad( quad pos, uquad value )
void WriteUShort( quad pos, ushort value )
Writes the value to the current file at the address pos. Note that if bytes are written past the end of the file, the file will automatically be expanded.

void WriteBytes( const uchar buffer[], quad pos, int n )
Writes n bytes from the array buffer to the file at the address pos. Note that char[] and uchar[] can be used interchangeably. If bytes are written past the end of the file, the file will automatically be expanded.

void WriteString( quad pos, const char value[] )
Writes the string value to the current file at address pos. Stops when the null-character is reached.

















This is the manual for 010 Editor, a professional hex editor and disk editor. Use 010 Editor to edit the individual bytes of any binary file, hard drive, or process on your machine. 010 Editor contains a whole host of powerful analysis and editing tools, plus Binary Templates technology that allows any binary format to be understood.






SweetScape Software
148 Pownal Rd. RR#1
Pownal, PEI
C0A 1Z0, Canada

E-mail: