pack_fclose(3)

NAME
pack_fclose, pack_fseek, pack_feof, pack_ferror, pack_getc, pack_putc, pack_igetw, pack_igetl, pack_iputw, pack_iputl, pack_mgetw, pack_mgetl, pack_mputw, pack_mputl, pack_fread, pack_fwrite, pack_fgets, pack_fputs

SYNOPSIS
#include <allegro.h>

int pack_fclose(PACKFILE *f); int pack_fseek(PACKFILE *f, int offset); int pack_feof(PACKFILE *f); int pack_ferror(PACKFILE *f); int pack_getc(PACKFILE *f); int pack_putc(int c, PACKFILE *f); int pack_igetw(PACKFILE *f); long pack_igetl(PACKFILE *f); int pack_iputw(int w, PACKFILE *f); long pack_iputl(long l, PACKFILE *f); int pack_mgetw(PACKFILE *f); long pack_mgetl(PACKFILE *f); int pack_mputw(int w, PACKFILE *f); long pack_mputl(long l, PACKFILE *f); long pack_fread(void *p, long n, PACKFILE *f); long pack_fwrite(const void *p, long n, PACKFILE *f); char *pack_fgets(char *p, int max, PACKFILE *f); int pack_fputs(const char *p, PACKFILE *f);

DESCRIPTION
These work like the equivalent stdio functions. There are some differences, however: Seeking only supports forward movement relative to the current position. Note that seeking is very slow when reading compressed files, and so should be avoided unless you are sure that the file is not compressed. The pack_i* and pack_m* routines read and write 16 and 32 bit values using the Intel and Motorola byte ordering systems (endianness) respectively. Intel is least significant byte first (little-endian); Motorola is most significant byte first (big-endian). pack_fread() and pack_fwrite() take a single size parameter instead of that silly size and num_elements system. The pack_fgets() function does not include a trailing carriage return in the returned string. pack_fputs() always writes in the UTF-8 text encoding format, converting from the current text encoding. Newlines (\n) are written as \r\n on DOS/Windows. If you do not want either of these things to happen, use pack_fwrite() and/or pack_putc() instead. pack_feof() returns nonzero as soon as you reach the end of the file. It does not wait for you to attempt to read beyond the end of the file, contrary to the ISO C feof() function. The only way to know whether you have read beyond the end of the file is to check the return value of the read operation you use (and be wary of pack_*getl() as EOF is also a valid return value with these functions).