Module index

# Module `ida_fpro`

System independent counterparts of FILE* related functions from Clib.

You should not use C standard I/O functions in your modules. The reason: Each module compiled with Borland (and statically linked to Borland's library) will host a copy of the FILE * information.

So, if you open a file in the plugin and pass the handle to the kernel, the kernel will not be able to use it.

If you really need to use the standard functions, define USE_STANDARD_FILE_FUNCTIONS. In this case do not mix them with q… functions.

## Functions

`def qfclose(fp: FILE *)`

  qfclose(fp) -> int

  @param fp: FILE *

`def qfile_t_from_capsule(pycapsule: PyObject *)`

  from_capsule(pycapsule) -> qfile_t

  @param pycapsule: PyObject *

`def qfile_t_from_fp(fp: FILE *)`

  from_fp(fp) -> qfile_t

  @param fp: FILE *

`def qfile_t_tmpfile()`

  tmpfile() -> qfile_t A static method to construct an instance using a temporary file

## Classes

`class qfile_t (*args)`

  A helper class to work with FILE related functions.

  init(self, rhs) -> qfile_t

  @param rhs: qfile_t const &

  init(self, pycapsule=None) -> qfile_t

  @param pycapsule: PyObject *

  ### Static methods

  `def from_capsule(pycapsule: PyObject *)`

    from_capsule(pycapsule) -> qfile_t

    @param pycapsule: PyObject *

  `def from_fp(fp: FILE *)`

    from_fp(fp) -> qfile_t

    @param fp: FILE *

  `def tmpfile()`

    tmpfile() -> qfile_t A static method to construct an instance using a temporary file

  ### Instance variables

  `var thisown`

    The membership flag

  ### Methods

  `def close(self)`

    close(self) Closes the file

  `def filename(self)`

    filename(self) -> PyObject *

  `def flush(self) ‑> int`

    flush(self) -> int

  `def get_byte(self)`

    get_byte(self) -> PyObject * Reads a single byte from the file. Returns None if EOF or the read byte

  `def get_fp(self)`

    get_fp(self) -> FILE *

  `def gets(self, size: int)`

    gets(self, size) -> PyObject * Reads a line from the input file. Returns the read line or None

    @param size: int

  `def open(self, filename: char const *, mode: char const *)`

    open(self, filename, mode) -> bool Opens a file

    @param filename: the file name @param mode: The mode string, ala fopen() style @return: Boolean

  `def opened(self) ‑> bool`

    opened(self) -> bool Checks if the file is opened or not

  `def put_byte(self, chr: int) ‑> int`

    put_byte(self, chr) -> int Writes a single byte to the file

    @param chr: int

  `def puts(self, str: char const *)`

    puts(self, str) -> int

    @param str: char const *

  `def read(self, size: int)`

    read(self, size) -> PyObject * Reads from the file. Returns the buffer or None

    @param size: int

  `def readbytes(self, size: int, big_endian: bool)`

    readbytes(self, size, big_endian) -> PyObject * Similar to read() but it respect the endianness

    @param size: int @param big_endian: bool

  `def seek(self, *args) ‑> int`

    seek(self, offset, whence=SEEK_SET) -> int Set input source position

    @param offset: int64 @param whence: int @return: the new position (not 0 as fseek!)

  `def size(self)`

    size(self) -> int64

  `def tell(self)`

    tell(self) -> int64 Returns the current position

  `def write(self, py_buf: PyObject *)`

    write(self, py_buf) -> int Writes to the file. Returns 0 or the number of bytes written

    @param py_buf: PyObject *

  `def writebytes(self, py_buf: PyObject *, big_endian: bool)`

    writebytes(self, py_buf, big_endian) -> int Similar to write() but it respect the endianness

    @param py_buf: PyObject * @param big_endian: bool