patcharats / tesseract-ocr

Automatically exported from code.google.com/p/tesseract-ocr
Other
0 stars 0 forks source link

specifiying explicitly binary/text flag in fopen() calls would be better for OS/2 port #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Because of LF CRLF differences in textfiles between *nix and OS/2 and
fopen() defaulting to text on OS/2 I have to use -Zbin-files with the OS/2
gcc compiler to default all fopen() calls to binary-mode and then I have to
use this patch:
--- cut ---
*** tesseractmain.cpp.original  2007-08-30 17:25:46.000000000 +0200
--- tesseractmain.cpp.modified  2007-09-27 17:32:32.000000000 +0200
***************
*** 190,196 ****

    outfile = argv[2];
    outfile += ".txt";
!   FILE* fp = fopen(outfile.string(), "w");
    if (fp != NULL) {
      fwrite(text_out.string(), 1, text_out.length(), fp);
      fclose(fp);
--- 190,196 ----

    outfile = argv[2];
    outfile += ".txt";
!   FILE* fp = fopen(outfile.string(), "wt");
    if (fp != NULL) {
      fwrite(text_out.string(), 1, text_out.length(), fp);
      fclose(fp);
--- cut ---

to get the ouputfile in CRLF mode which is better on OS/2.
Specifying explicitly b or t in all fopen() calls could avoid this workaround.

Original issue reported on code.google.com by fba...@gmx.net on 28 Sep 2007 at 7:56

GoogleCodeExporter commented 9 years ago

Original comment by theraysm...@gmail.com on 20 May 2010 at 11:10

GoogleCodeExporter commented 9 years ago
Fixed in r604
binary mode is used everywhere to produce same output on all platforms...

Original comment by zde...@gmail.com on 11 Aug 2011 at 9:44