I'm using gosseract, a Go OCR package that uses Tesseract for reading characters from images. I am using the demo's code right now like so:
client := gosseract.NewClient()
defer client.Close()
client.SetImage("helloworld.png")
text, _ := client.Text()
fmt.Println(text)
That's fine, but when I run the program it prints out:
# github.com/otiai10/gosseract
tessbridge.cpp: In function ‘int Init(TessBaseAPI, char*, char*, char*, char*)’:
tessbridge.cpp:46:10: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
46 | freopen("/dev/null", "a", stderr);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
tessbridge.cpp:60:10: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
60 | freopen("/dev/null", "a", stderr);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Hello World!
The warnings print regardless of whether I output text
or not
Is there any way I can just suppress the warnings at the beginning of my output? I know this problem is probably better suited for the Issues section of that package, but I wanted to know if there was a built in way to hide those messages in any package.