-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcsv.h
52 lines (43 loc) · 1.12 KB
/
csv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef MBA_CSV_H
#define MBA_CSV_H
/* csv - read write comma separated value format
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef LIBMBA_API
#ifdef WIN32
# ifdef LIBMBA_EXPORTS
# define LIBMBA_API __declspec(dllexport)
# else /* LIBMBA_EXPORTS */
# define LIBMBA_API __declspec(dllimport)
# endif /* LIBMBA_EXPORTS */
#else /* WIN32 */
# define LIBMBA_API extern
#endif /* WIN32 */
#endif /* LIBMBA_API */
#include <stdio.h>
#include "text.h"
#if USE_WCHAR
#define csv_row_parse csv_row_parse_wcs
#else
#define csv_row_parse csv_row_parse_str
#endif
#define CSV_TRIM 0x01
#define CSV_QUOTES 0x02
LIBMBA_API int csv_row_parse_str(const unsigned char *src, size_t sn,
unsigned char *buf, size_t bn,
unsigned char *row[], int rn,
int sep, int flags);
LIBMBA_API int csv_row_parse_wcs(const wchar_t *src, size_t sn,
wchar_t *buf, size_t bn,
wchar_t *row[], int rn,
int sep, int flags);
LIBMBA_API int csv_row_fread(FILE *in,
unsigned char *buf, size_t bn,
unsigned char *row[], int numcols,
int sep, int flags);
#ifdef __cplusplus
}
#endif
#endif /* MBA_CSV_H */