Freeciv-3.2
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
ioz.h File Reference
#include <stdio.h>
#include <freeciv_config.h>
#include "shared.h"

Go to the source code of this file.

Typedefs

typedef struct fz_FILE_s fz_FILE
 

Enumerations

enum  fz_method { FZ_PLAIN = 0 }
 

Functions

fz_FILEfz_from_file (const char *filename, const char *in_mode, enum fz_method method, int compress_level)
 
fz_FILEfz_from_stream (FILE *stream)
 
fz_FILEfz_from_memory (char *buffer, int size, bool control)
 
int fz_fclose (fz_FILE *fp)
 
charfz_fgets (char *buffer, int size, fz_FILE *fp)
 
int fz_fprintf (fz_FILE *fp, const char *format,...) fc__attribute((__format__(__printf__
 
int int fz_ferror (fz_FILE *fp)
 
const charfz_strerror (fz_FILE *fp)
 

Typedef Documentation

◆ fz_FILE

Definition at line 33 of file ioz.h.

Enumeration Type Documentation

◆ fz_method

Enumerator
FZ_PLAIN 

Definition at line 36 of file ioz.h.

Function Documentation

◆ fz_fclose()

int fz_fclose ( fz_FILE fp)

Close file, like fclose. Returns 0 on success, or non-zero for problems (but don't call fz_ferror in that case because the struct has already been free'd; wishlist: better interface for errors?) (For FZ_PLAIN returns EOF and could check errno; for FZ_ZLIB: returns zlib error number; see zlib.h.)

Definition at line 571 of file ioz.c.

Referenced by get_token_value(), inf_close_partial(), and secfile_save().

◆ fz_ferror()

int int fz_ferror ( fz_FILE fp)

Return non-zero if there is an error status associated with this stream. Check fz_strerror for details.

Definition at line 1099 of file ioz.c.

Referenced by inf_close_partial(), and secfile_save().

◆ fz_fgets()

char * fz_fgets ( char buffer,
int  size,
fz_FILE fp 
)

Get a line, like fgets. Returns NULL in case of error, or when end-of-file reached and no characters have been read.

Definition at line 655 of file ioz.c.

Referenced by get_token_value(), and read_a_line().

◆ fz_fprintf()

int fz_fprintf ( fz_FILE fp,
const char format,
  ... 
)

◆ fz_from_file()

fz_FILE * fz_from_file ( const char filename,
const char in_mode,
enum fz_method  method,
int  compress_level 
)

Open file for reading/writing, like fopen. Parameters compress_method and compress_level only apply for writing: for reading try to use the most appropriate available method. Returns NULL if there was a problem; check errno for details. (If errno is 0, and using FZ_ZLIB, probably had zlib error Z_MEM_ERROR. Wishlist: better interface for errors?)

Definition at line 230 of file ioz.c.

Referenced by get_token_value(), inf_from_file(), and secfile_save().

◆ fz_from_memory()

fz_FILE * fz_from_memory ( char buffer,
int  size,
bool  control 
)

Open memory buffer for reading as fz_FILE. If control is TRUE, caller gives up control of the buffer so ioz will free it when fz_FILE closed.

Definition at line 207 of file ioz.c.

Referenced by netfile_get_section_file().

◆ fz_from_stream()

fz_FILE * fz_from_stream ( FILE stream)

Open uncompressed stream for reading/writing.

Definition at line 548 of file ioz.c.

Referenced by fc_querysocket().

◆ fz_strerror()

const char * fz_strerror ( fz_FILE fp)

Return string (pointer to static memory) containing an error description associated with the file. Should only call this is you know there is an error (eg, from fz_ferror()). Note the error string may be based on errno, so should call this immediately after problem, or possibly something else might overwrite errno.

Definition at line 1157 of file ioz.c.

Referenced by inf_close_partial(), and secfile_save().