Esempio n. 1
0
func (t *TesseractAPI) BaseAPISetVariable(name string, value string) C.int {
	cName := C.CString(name)
	defer C.free(unsafe.Pointer(cName))

	cValue := C.CString(value)
	defer C.free(unsafe.Pointer(cValue))

	return C.TessBaseAPISetVariable(t.api, cName, cValue)
}
Esempio n. 2
0
// BOOL TessBaseAPISetVariable(TessBaseAPI* handle, const char* name, const char* value);
func (t *Tess) SetVariable(name, value string) error {
	cName := C.CString(name)
	defer C.free(unsafe.Pointer(cName))

	cValue := C.CString(value)
	defer C.free(unsafe.Pointer(cValue))

	worked := C.TessBaseAPISetVariable(t.tba, cName, cValue)
	if worked != 1 {
		return errors.New("Unable to set the variable: " + name + " to " + value)
	}
	return nil
}