Libcsv
Jump to navigation
Jump to search
Overview
CSV Parser library, libcsv 내용 정리
Basic
libcsv 는 csv string parsing 을 위한 C 라이브러리이다.
Functions
csv_write()
<source lang=c> size_t csv_write(void *dest, size_t dest_size, const void *src, size_t src_size); </source>
csv_fwrite()
<source lang=c> int csv_fwrite(FILE *fp, const void *src, size_t src_size); </source>
Example
simple_csv_write
<source lang=c>
- include <stdio.h>
- include <string.h>
- include <csv.h>
int main (void) {
char* res; char* tmp_const; int ret; tmp_const = ",\",I like a,\"\" Super mario.";
printf("str[%s], len[%ld]\n", tmp_const, strlen(tmp_const)); res = malloc(100); ret = csv_write(res, 100, tmp_const, strlen(tmp_const)); printf("ret[%d], res[%s]\n", ret, res); return 0;
} </source>
$ ./main str[,",I like a,"" Super mario.], len[27] ret[32], res[","",I like a,"""" Super mario."]