Libcsv: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
(Created page with "== Overview == CSV Parser library, libcsv 내용 정리 == Basic == libcsv 는 csv string parsing 을 위한 C 라이브러리이다. == Example == === simple_csv_write ===...")
 
 
Line 4: Line 4:
== Basic ==
== Basic ==
libcsv 는 csv string parsing 을 위한 C 라이브러리이다.
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 ==
== Example ==

Latest revision as of 14:25, 23 June 2016

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>

  1. include <stdio.h>
  2. include <string.h>
  3. 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."]