A helper class to work with FILE related functions.
|
| __init__ (self, *args) |
| init(self, rhs) -> qfile_t
|
|
"bool" | opened (self) |
| Checks if the file is opened or not.
|
|
"void" | close (self) |
| Closes the file.
|
|
"bool" | open (self, "char const *" filename, "char const *" mode) |
| Opens a file.
|
|
"FILE *" | get_fp (self) |
| get_fp(self) -> FILE *
|
|
"int" | seek (self, *args) |
| Set input source position.
|
|
"int64" | tell (self) |
| Returns the current position.
|
|
"PyObject *" | readbytes (self, "int" size, "bool" big_endian) |
| Similar to read() but it respect the endianness.
|
|
"PyObject *" | read (self, "int" size) |
| Reads from the file.
|
|
"PyObject *" | gets (self, "int" size) |
| Reads a line from the input file.
|
|
"int" | writebytes (self, "PyObject *" py_buf, "bool" big_endian) |
| Similar to write() but it respect the endianness.
|
|
"int" | write (self, "PyObject *" py_buf) |
| Writes to the file.
|
|
"int" | puts (self, "char const *" str) |
| puts(self, str) -> int
|
|
"int64" | size (self) |
| size(self) -> int64
|
|
"int" | flush (self) |
| flush(self) -> int
|
|
"PyObject *" | filename (self) |
| filename(self) -> PyObject *
|
|
"PyObject *" | get_byte (self) |
| Reads a single byte from the file.
|
|
"int" | put_byte (self, "int" chr) |
| Writes a single byte to the file.
|
|
|
"qfile_t *" | from_fp ("FILE *" fp) |
| from_fp(fp) -> qfile_t
|
|
"qfile_t *" | from_capsule ("PyObject *" pycapsule) |
| from_capsule(pycapsule) -> qfile_t
|
|
"qfile_t *" | tmpfile () |
| A static method to construct an instance using a temporary file.
|
|
|
| thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") |
|
◆ __init__()
__init__ |
( |
| self, |
|
|
* | args ) |
- Parameters
-
init(self, pycapsule=None) -> qfile_t
- Parameters
-
◆ close()
◆ filename()
"PyObject *" filename |
( |
| self | ) |
|
◆ flush()
◆ from_capsule()
"qfile_t *" from_capsule |
( |
"PyObject *" | pycapsule | ) |
|
|
static |
◆ from_fp()
"qfile_t *" from_fp |
( |
"FILE *" | fp | ) |
|
|
static |
◆ get_byte()
"PyObject *" get_byte |
( |
| self | ) |
|
Returns None if EOF or the read byte
◆ get_fp()
◆ gets()
"PyObject *" gets |
( |
| self, |
|
|
"int" | size ) |
Returns the read line or None
- Parameters
-
len | the maximum line length |
◆ open()
"bool" open |
( |
| self, |
|
|
"char const *" | filename, |
|
|
"char const *" | mode ) |
- Parameters
-
filename | the file name |
mode | The mode string, ala fopen() style |
- Returns
- : Boolean
◆ opened()
◆ put_byte()
"int" put_byte |
( |
| self, |
|
|
"int" | chr ) |
◆ puts()
"int" puts |
( |
| self, |
|
|
"char const *" | str ) |
◆ read()
"PyObject *" read |
( |
| self, |
|
|
"int" | size ) |
Returns the buffer or None
- Parameters
-
size | the maximum number of bytes to read |
- Returns
- : a str, or None
◆ readbytes()
"PyObject *" readbytes |
( |
| self, |
|
|
"int" | size, |
|
|
"bool" | big_endian ) |
- Parameters
-
size | the maximum number of bytes to read |
big_endian | endianness |
- Returns
- : a str, or None
◆ seek()
"int" seek |
( |
| self, |
|
|
* | args ) |
- Parameters
-
offset | the seek offset |
whence | the position to seek from |
- Returns
- : the new position (not 0 as fseek!)
◆ size()
◆ tell()
◆ tmpfile()
◆ write()
"int" write |
( |
| self, |
|
|
"PyObject *" | py_buf ) |
Returns 0 or the number of bytes written
- Parameters
-
- Returns
- : result code
◆ writebytes()
"int" writebytes |
( |
| self, |
|
|
"PyObject *" | py_buf, |
|
|
"bool" | big_endian ) |
- Parameters
-
buf | the str to write |
big_endian | endianness |
- Returns
- : result code
◆ thisown
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") |
|
static |
The documentation for this class was generated from the following file: