/ gwfile.h / Functions / Description

Functions



gw_file_copy

Copies file
int gw_file_copy ( const gchar *source, const gchar *dest);
This function copies a file to another file.


Parameters
source source file to copy
dest destination file for copy

Result: an error code.
Returns 0 when it's done.
Returns -1 when an error occured.
.


gw_file_read_until_c

Reads caracters in a file
gchar * gw_file_read_until_c ( int fic, gchar c, int len);
This function reads caracters in a file until a specified caractere.


Parameters
fic the file where extract caracters
c the delimitor caracter
len the line max size

Result: the string when it's done.
Returns NULL when an error occured or when the caracter aren't in the file..


gw_zfile_read_until_c

Reads caracters in a file
gchar * gw_zfile_read_until_c ( gzFile fic, gchar c, int len);
This function reads caracters in a file until a specified caractere.
If len is -1 readed line has no limits and the string will be allocated.

Parameters
fic the compressed file where extract caracters
c the delimitor caracter
len th eline max size

Result: the string when it's done.
Returns NULL when an error occured or when the caracter aren't in the file..


gw_file_readline

Reads line in a file
gchar * gw_file_readline ( int fic, gchar *buf, int len);
This function reads a line in a file.
If len is -1 readed line has no limits and the string will be allocated.

Parameters
fic the file where extract line
buf the string to store readed line
len the line max size

Result: the string when it's done.
Returns NULL when an error occured..


gw_zfile_readline_sb

Reads line in a compressed file
gchar * gw_zfile_readline_sb ( gzFile fic, GWStringBuffer **sb);
This function reads a line in a compressed file.


Parameters
fic the compressed file where extract line
sb the string buffer to store readed line

Result: the string when it's done.
Returns NULL when an error occured..


gw_zfile_readline

Reads line in a compressed file
gchar * gw_zfile_readline ( gzFile fic, gchar **buf, int len);
This function reads a line in a compressed file.
If len is -1 readed line has no limits and the string will be allocated. Otherwise the buffer must be allocated before call gw_zfile_readline().

Parameters
fic the compressed file where extract line
buf the string to store readed line
len the line max size

Result: the string when it's done.
Returns NULL when an error occured..


gw_file_get_size

Gets the size of a file
long gw_file_get_size ( FILE * file);
This function gets the size of a file.


Parameters
file the file to get size

Result: the file size.
Returns -1 when an error occured..


gw_file_exists

Tests whether the file denoted by this abstract pathname exists.
int gw_file_exists ( const gchar *pathname);
This function tests whether the file denoted by this abstract pathname exists.


Parameters
pathname file name

Result: an error code.
Returns 0 if and only if the file denoted by this abstract pathname exists.
Returns -1 otherwise or when an error occured..


gw_file_get_name

Tests whether the file denoted by this abstract pathname exists.
gchar * gw_file_get_name ( const gchar *pathname);
This function returns the name of the file or directory denoted by this abstract pathname. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the NULL pointer is returned.
Note that the returned string should be freed by g_free().


Parameters
pathname file name

Result: file name.
Returns NULL otherwise or when an error occured..


gw_file_mkdir

Creates the directory named by this abstract pathname.
int gw_file_mkdir ( const gchar *pathname);
This function creates the directory named by this abstract pathname.


Parameters
pathname directory pathname

Result: an error code.
Returns 0 if the directory was created or if the directory already exists.
Returns -1 otherwise or when an error occured..


gw_file_mkdirs

Creates the directory named by this abstract pathname
int gw_file_mkdirs ( const gchar *pathname);
This function creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.
Note that the abstract pathname should not end with "/" character.


Parameters
pathname directory pathname

Result: an error code.
Returns 0 if the directory was created, along with all necessary parent directories or if the directory already exists.
Returns -1 otherwise or when an error occured..


gw_zfile_uncompress

Uncompresses source file to destination file.
int gw_zfile_uncompress ( const gchar *in_filepath, const gchar *out_filepath);
This function uncompresses source file to destination file.


Parameters
in_pathname source file pathname
out_pathname destination file pathname

Result: an error code.
Returns 0 cannot uncompress the source file.
Returns -1 otherwise or when an error occured..