Calling C function with file handles
- Posted by aku at inbox.as Feb 24, 2001
- 368 views
A function in bz2lib.dll typedef void BZFILE; BZFILE *BZ2_bzReadOpen ( int *bzerror, FILE *f, int small, int verbosity, void *unused, int nUnused ); Description: To make the library a little simpler and more portable, BZ2_bzReadOpen and BZ2_bzWriteOpen require you to pass them file handles (FILE*s) which have previously been opened for reading or writing respectively. That avoids portability problems associated with file operations and file attributes, whilst not being much of an imposition on the programmer. The FILE* arguments passed to BZ2_bzReadOpen/BZ2_bzWriteOpen should be set to binary mode. Most Unix systems will do this by default, but other platforms, including Windows and Mac, will not. If you omit this, you may encounter problems when moving code to new platforms. How can I convert the function to call in euphoria? Because of the "FILE *f" it is file handle. It is not the value returned by open(), isn't it?