1detect_obj_init(3) Library Functions Manual detect_obj_init(3)
2
3
4
6 detect_obj_init - initialize DetectObject structure
7
8
10 #include <chardet.h>
11 DetectObj chardet_obj_init (void);
12
13
15 initialize DetectObj structure that is stored chardet informations.
16
17
19 Returns DetectObject structure. The return value is must freed by
20 chardet_obj_free api.
21
22 typedef struct DetectObject {
23 char * encoding;
24 float confidence;
25 } DetectObj;
26
28 #include <chardet.h>
29
30 int main (void) {
31 DetectObj *obj;
32
33 if ( (obj = detect_obj_init ()) == NULL ) {
34 fprintf (stderr, "Memory Allocation failed\n");
35 return CHARDET_MEM_ALLOCATED_FAIL;
36 }
37
38 switch (detect ("¾È³çÇϼ¼¿ä", &obj)) {
39 case CHARDET_OUT_OF_MEMORY :
40 fprintf (stderr, "On handle processing, occured out of memory\n");
41 detect_obj_free (&obj);
42 return CHARDET_OUT_OF_MEMORY;
43 case CHARDET_NULL_OBJECT :
44 fprintf (stderr,
45 "2st argument of chardet() is must memory allocation "
46 "with detect_obj_init API\n");
47 return CHARDET_NULL_OBJECT;
48 }
49
50 printf ("encoding: %s, confidence: %f\n", obj->encoding, obj->confidence);
51 detect_obj_free (&obj);
52
53 return 0;
54 }
55
56
58 JoungKyun.Kim <http://oops.org>
59
60
62 Use QnA board on http://oops.org
63
64
66 detect_obj_free(3), detect(3), detect_handledata(3)
67
68
69
70
71libchardet manuals 2015-12-11 detect_obj_init(3)