diff --git a/dict/permdawg.cpp b/dict/permdawg.cpp index 20fb5792..5d9241f6 100644 --- a/dict/permdawg.cpp +++ b/dict/permdawg.cpp @@ -195,7 +195,7 @@ void Dict::go_deeper_dawg_fxn( strcmp(output_ambig_words_file.string(), "") != 0) { if (output_ambig_words_file_ == NULL) { output_ambig_words_file_ = - fopen(output_ambig_words_file.string(), "w+"); + fopen(output_ambig_words_file.string(), "wb+"); if (output_ambig_words_file_ == NULL) { tprintf("Failed to open output_ambig_words_file %s\n", output_ambig_words_file.string()); diff --git a/training/ambiguous_words.cpp b/training/ambiguous_words.cpp index 0c969aef..7f87b373 100644 --- a/training/ambiguous_words.cpp +++ b/training/ambiguous_words.cpp @@ -58,7 +58,7 @@ int main(int argc, char** argv) { api.Init(tessdata_dir, lang.string(), tesseract::OEM_TESSERACT_ONLY, NULL, NULL, &vars_vec, &vars_values, false); tesseract::Dict &dict = api.tesseract()->getDict(); - FILE *input_file = fopen(input_file_str, "r"); + FILE *input_file = fopen(input_file_str, "rb"); if (input_file == NULL) { tprintf("Failed to open input wordlist file %s\n", input_file_str); exit(1); diff --git a/training/dawg2wordlist.cpp b/training/dawg2wordlist.cpp index e982d655..82698295 100644 --- a/training/dawg2wordlist.cpp +++ b/training/dawg2wordlist.cpp @@ -54,7 +54,7 @@ class WordOutputter { int WriteDawgAsWordlist(const UNICHARSET &unicharset, const tesseract::Dawg *dawg, const char *outfile_name) { - FILE *out = fopen(outfile_name, "w"); + FILE *out = fopen(outfile_name, "wb"); if (out == NULL) { tprintf("Could not open %s for writing.\n", outfile_name); return 1;