An assortment of functions used to manipulate files and directories.
More...
#include <stdio.h>
Go to the source code of this file.
|
char * | read_line (FILE *f) |
| read a line of any size from a file More...
|
|
char * | file_to_str (FILE *f) |
| read a file into a string More...
|
|
void | conf_option (char *ln, char **keyword_start, char **item_start) |
| extract info from a line of a configuration file More...
|
|
int | is_conf_path (const char *name) |
| determine if a file is a configuration file, from the file name More...
|
|
An assortment of functions used to manipulate files and directories.
void conf_option |
( |
char * |
ln, |
|
|
char ** |
keyword_start, |
|
|
char ** |
item_start |
|
) |
| |
extract info from a line of a configuration file
Given a line of a configuration file, such as "key value", separates the key from the value, and returns strings of each. Note ln is no longer a valid string. If ln is on the heap, it must be freed in an appropriate manner, which frees the strings pointed to by keyword_start and item_start. ln must be freed if it is on the heap, regardless of the output of this function.
- Parameters
-
[in] | ln | a line of a configuration file |
[out] | keyword_start | where to place the keyword string, or null if no items found |
[out] | item_start | where to place the item string, or null if no item found |
char* file_to_str |
( |
FILE * |
f | ) |
|
read a file into a string
- Parameters
-
- Returns
- the contents of the file, in a string
int is_conf_path |
( |
const char * |
name | ) |
|
determine if a file is a configuration file, from the file name
- Parameters
-
- Returns
- 1 if a configuration file, otherwise 0
char* read_line |
( |
FILE * |
f | ) |
|
read a line of any size from a file
- Parameters
-
- Returns
- the line. Free with free().