detect_handledata(3) Library Functions Manual detect_handledata(3) detect_handledata, detect_handledata_r - #include short detect_handledata (Detect ** handle, const char * inbuf, DetectObj ** outbuf); short detect_handledata_r (Detect ** handle, const char * inbuf, size_t inlen, DetectObj ** outbuf); inbuf outbuf . detect_handledata API binary safe . detect_handledata_r API . API handle detect_init api detect handle resource. inbuf inlen outbuf inbuf . outbuf . typedef struct DetectObject { char * encoding; float confidence; } DetectObj; outbuf detect_obj_init api detect api . . CHARDET_SUCCESS CHARDET_NO_RESULT CHARDET_NULL_OBJECT outbuf chardet_obj_init api . CHARDET_OUT_OF_MEMORY API out of memory #include int main (void) { Detect * d; DetectObj * obj; int i, arrayNum; char *str[] = { "this is ascii", " euc-kr ." }; arrayNum = sizeof (str) / sizeof (str[0]); if ( (d = detect_init ()) == NULL ) { fprintf (stderr, "chardet handle initialize failed\n"); return CHARDET_MEM_ALLOCATED_FAIL; } for ( i=0; i CHARDET_BOM_CHECK . printf ("encoding: %s, confidence: %f, exists bom: %d\n", obj->encoding, obj->confidence, obj->bom); detect_obj_free (&obj); } detect_destroy (&d); return 0; } https://github.com/Joungkyun/libchardet/issues detect_obj_init(3), detect_obj_free(3), detect_init(3), detect_reset(3), detect_destroy(3) libchardet manuals 2019-08-01 detect_handledata(3)