G1M_OPEN(3) ========= Thomas "Cakeisalie5" Touhey :Email: thomas@touhey.fr :man source: libg1m :man manual: libg1m manual NAME ---- g1m_open, g1m_fopen - open and decode a file SYNOPSIS -------- [source,c] ---- #include int g1m_open(g1m_t **handle, const char *path, g1m_type_t expected_types); int g1m_fopen(g1m_t **handle, FILE *stream, g1m_type_t expected_types); ---- DESCRIPTION ----------- Open and decode a file. If everything goes well, the handle is stored at **handle*. If you are expecting one or more types in particular, set *expected_types* to the OR'd types (e.g. _g1m_type_mcs | g1m_type_storage_), then, if the wrong type is found, the file will not be decoded to the end, only to the point where it can be identified. If you aren't expecting any type in particular, set *expected_types* to zero. *g1m_open* will open the file at the given path, decode it, and close it, whereas *g1m_fopen* will take an opened stream (with libc) and will not close it. Only reading is required (writing and seeking capabilities are not). In case of a decoding error (magic problem, memory allocation error, ...), the stream is unusable as the number of read bytes by libg1m is not known. RETURN VALUE ------------ This function returns zero if everything went well, and the error code otherwise. ERRORS ------ See *g1m_error*(3). SEE ALSO -------- *libg1m*(3)