Man page - detect_reset(3)
Packages contains this manual
apt-get install libchardet-dev
Available languages:
en koManual
detect_reset
μ΄ λ¦μ¬ μ© λ²
μ€ λͺ
λ° ν κ°
μ μ
μ μ
λ² κ·Έ 리 ν¬ νΈ
μ μ κΆ
μ°Έ κ³
μ΄ λ¦
detect_reset - chardet file handle reset
μ¬ μ© λ²
#include
<chardet.h>
void chardet_reset (Detect **handle);
μ€ λͺ
chardet library μ file handle μ μ¬ μ΄ κΈ° ν ν λ€ .
λ° ν κ°
λ° ν κ° μ μ
μ μ
#include <chardet.h>
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<arrayNum; i++ ) { |
|||||||
|
detect_reset (&d); |
|||||||
|
if ( (obj = detect_obj_init ()) == NULL ) { |
|||||||
|
fprintf (stderr, "Memory Allocation failed\n"); |
|||||||
|
return CHARDET_MEM_ALLOCATED_FAIL; |
|||||||
|
} |
|||||||
|
switch (detect_handledata (&d, "μ λ ν μΈ μ ", &obj)) { |
|||||||
|
case CHARDET_OUT_OF_MEMORY : |
|||||||
|
fprintf (stderr, "On handle processing, occured out of memory\n"); |
|||||||
|
detect_obj_free (&obj); |
|||||||
|
return CHARDET_OUT_OF_MEMORY; |
|||||||
|
case CHARDET_NULL_OBJECT : |
|||||||
|
fprintf (stderr, |
|||||||
|
"2st argument of chardet() is must memory allocation " |
|||||||
|
"with detect_obj_init API\n"); |
|||||||
|
return CHARDET_NULL_OBJECT; |
|||||||
|
} |
|||||||
|
# obj-bom μ 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
μ μ κΆ
Copyright (c) 2019 JoungKyun.Kim
μ΄ ν λ‘ κ·Έ λ¨ μ MPL/GPL2/LGPL2.1 μ λ° λ₯΄ λ©° , μ¬ μ© μ μ μ΄ λ ν λ¬Έ μ μ λ ν μ¬ λ³΄ μ¦ ν μ§ μ λ λ€ .
μ°Έ κ³
detect_obj_init(3), detect_obj_free(3), detect_init(3), detect_handledata(3), detect_destroy(3)