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

NAME

6       detect_destroy - free Detector structure
7
8

SYNOPSIS

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

DESCRIPTION

16       Free resource that allocated by detect_init api.
17
18

RETURN VALUE

20       void
21
22

EXAMPLE

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

AUTHORS

63       JoungKyun.Kim <http://oops.org>
64
65

BUG REPORTS

67       Use QnA board on http://oops.org
68
69

SEE ALSO

71       detect_init(3), detect_reset(3)
72
73
74
75libchardet manuals                2015-12-11                 detect_destroy(3)
Impressum