root / approxBasisSollya / read-lines-from-file.h @ 300
Historique | Voir | Annoter | Télécharger (1,18 ko)
1 |
/** @file read-lines-from-file.h
|
---|---|
2 |
* Read lines from a text file, filtering out empty, #-comment lines,
|
3 |
* leading spaces and tab, trailing comments.
|
4 |
* @author S.T.
|
5 |
* @date 2016/10/18
|
6 |
*/
|
7 |
/******************************************************************************/
|
8 |
|
9 |
/*
|
10 |
* Prerequisites for use:
|
11 |
* The user must include
|
12 |
* #include <stdio.h>
|
13 |
* #include <libgen.h>
|
14 |
*/
|
15 |
|
16 |
#ifndef RLFF_INCLUDE_h
|
17 |
#define RLFF_INCLUDE_h
|
18 |
|
19 |
/* Types, constants and macros definitions. */
|
20 |
typedef struct rlff_readLines rlff_readLines_t; |
21 |
struct rlff_readLines
|
22 |
{ |
23 |
unsigned int linesNum; |
24 |
unsigned int linesLenght; |
25 |
char* lines;
|
26 |
}; |
27 |
|
28 |
/* Exported functions. */
|
29 |
/** Free a readLines_t object. */
|
30 |
void
|
31 |
rlff_free_lines(rlff_readLines_t* linesRead); |
32 |
|
33 |
char*
|
34 |
rlff_get_line_at(rlff_readLines_t* linesRead, unsigned int lineIndex); |
35 |
|
36 |
/** Print the lines. */
|
37 |
void
|
38 |
rlff_print_lines(rlff_readLines_t* linesRead); |
39 |
|
40 |
/** Read the lines from a file give by name. */
|
41 |
rlff_readLines_t* |
42 |
rlff_read_lines_from_file_name(char* fileName);
|
43 |
|
44 |
/** Read the lines from a file give by a handle on the file file. */
|
45 |
rlff_readLines_t* |
46 |
rlff_read_lines_from_file_handle(FILE* fileHandle); |
47 |
|
48 |
#endif
|
49 |
|