Module pywraps :: Class qfile_t
[frames] | no frames]

Class qfile_t

??-143 --+
         |
        qfile_t

A helper class to work with FILE related functions.

Instance Methods
 
__init__(self)
 
close(self)
Closes the file
 
open(self, filename, mode)
Opens a file
 
set_linput(self, linput)
Links the current loader_input_t instance to a linput_t instance
 
seek(self, pos, whence=SEEK_SET)
Set input source position
 
tell(self)
Returns the current position
 
gets(self, len)
Reads a line from the input file.
 
read(self, size)
Reads from the file.
 
write(self, buf)
Writes to the file.
 
readbytes(self, size, big_endian)
Similar to read() but it respect the endianness
 
writebytes(self, size, big_endian)
Similar to write() but it respect the endianness
 
flush(self)
 
get_char(self)
Reads a single character from the file.
 
put_char(self)
Writes a single character to the file
 
opened(self)
Checks if the file is opened or not
Static Methods
 
tmpfile()
A static method to construct an instance using a temporary file
Method Details

open(self, filename, mode)

 

Opens a file

Parameters:
  • filename - the file name
  • mode - The mode string, ala fopen() style
Returns:
Boolean

seek(self, pos, whence=SEEK_SET)

 

Set input source position

Returns:
the new position (not 0 as fseek!)

gets(self, len)

 

Reads a line from the input file. Returns the read line or None

read(self, size)

 

Reads from the file. Returns the buffer or None

write(self, buf)

 

Writes to the file. Returns 0 or the number of bytes written

get_char(self)

 

Reads a single character from the file. Returns None if EOF or the read character