1detect_init(3)             Library Functions Manual             detect_init(3)
2
3
4

NAME

6       detect_init - initialize Detect structure
7
8

SNOPSIS

10       #include <chardet.h>
11       Detect * chardet_init (void);
12
13

DESCRIPTION

15       initialize Detect structure.
16
17

RETURN VALUE

19       Returns NULL on false and returns Detect structure on success.
20
21            typedef struct Detect_t {
22                 Detector *detect;
23            } Detect;
24

EXAMPLE

26       #include <chardet.h>
27
28       int main (void) {
29            Detect    * d;
30            DetectObj * obj;
31
32            if ( (d = detect_init ()) == NULL ) {
33                 fprintf (stderr, "chardet handle initialize failed\n");
34                 return CHARDET_MEM_ALLOCATED_FAIL;
35            }
36
37            detect_reset (&d);
38
39            if ( (obj = detect_obj_init ()) == NULL ) {
40                 fprintf (stderr, "Memory Allocation failed\n");
41                 return CHARDET_MEM_ALLOCATED_FAIL;
42            }
43
44            switch (detect_handledata (&d, "¾È³çÇϼ¼¿ä", &obj)) {
45                 case CHARDET_OUT_OF_MEMORY :
46                      fprintf (stderr, "On handle processing, occured out of memory\n");
47                      detect_obj_free (&obj);
48                      return CHARDET_OUT_OF_MEMORY;
49                 case CHARDET_NULL_OBJECT :
50                      fprintf (stderr,
51                                "2st argument of chardet() is must memory allocation "
52                                "with detect_obj_init API\n");
53                      return CHARDET_NULL_OBJECT;
54            }
55
56            printf ("encoding: %s, confidence: %f\n", obj->encoding, obj->confidence);
57            detect_obj_free (&obj);
58            detect_destroy (&d);
59
60           return 0;
61       }
62
63

AUTHORS

65       JoungKyun.Kim <http://oops.org>
66
67

BUG REPORTS

69       Use QnA board on http://oops.org
70
71

SEE ALSO

73       detect_obj_init(3), detect_obj_free(3), detect_reset(3), detect_handle‐
74       data(3), detect_destroy(3)
75
76
77
78
79libchardet manuals                2015-12-11                    detect_init(3)
Impressum