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

NAME

6       detect_reset - reset Detect structure
7
8

SNOPSIS

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

DESCRIPTION

15       reset Detect structure
16
17

RETURN VALUE

19       void
20

EXAMPLE

22       #include <chardet.h>
23
24       int main (void) {
25            Detect    * d;
26            DetectObj * obj;
27            int i, arrayNum;
28            char *str[] = {
29                 "this is ascii",
30                 "ÀÌ°Ç euc-kr ÀÔ´Ï´Ù."
31            };
32
33            arrayNum = sizeof (str) / sizeof (str[0]);
34
35            if ( (d = detect_init ()) == NULL ) {
36                 fprintf (stderr, "chardet handle initialize failed\n");
37                 return CHARDET_MEM_ALLOCATED_FAIL;
38            }
39
40            for ( i=0; i<arrayNum; i++ ) {
41                 detect_reset (&d);
42
43                 if ( (obj = detect_obj_init ()) == NULL ) {
44                      fprintf (stderr, "Memory Allocation failed\n");
45                      return CHARDET_MEM_ALLOCATED_FAIL;
46                 }
47
48                 switch (detect_handledata (&d, "¾È³çÇϼ¼¿ä", &obj)) {
49                      case CHARDET_OUT_OF_MEMORY :
50                           fprintf (stderr, "On handle processing, occured out of memory\n");
51                           detect_obj_free (&obj);
52                           return CHARDET_OUT_OF_MEMORY;
53                      case CHARDET_NULL_OBJECT :
54                           fprintf (stderr,
55                                     "2st argument of chardet() is must memory allocation "
56                                     "with detect_obj_init API\n");
57                           return CHARDET_NULL_OBJECT;
58                 }
59
60                 printf ("encoding: %s, confidence: %f\n", obj->encoding, obj->confidence);
61                 detect_obj_free (&obj);
62            }
63            detect_destroy (&d);
64
65           return 0;
66       }
67
68

AUTHORS

70       JoungKyun.Kim <http://oops.org>
71
72

BUG REPORTS

74       Use QnA board on http://oops.org
75
76

SEE ALSO

78       detect_obj_init(3),  detect_obj_free(3), detect_init(3), detect_handle‐
79       data(3), detect_destroy(3)
80
81
82
83
84libchardet manuals                2015-12-11                   detect_reset(3)
Impressum