diff options
-rw-r--r-- | utils/storage/gen_pinyin_table.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/storage/gen_pinyin_table.cpp b/utils/storage/gen_pinyin_table.cpp index 853e8c8..3b541d1 100644 --- a/utils/storage/gen_pinyin_table.cpp +++ b/utils/storage/gen_pinyin_table.cpp @@ -143,11 +143,15 @@ void feed_file ( const char * filename){ } while ( !feof(infile)){ - fscanf(infile, "%s", phrase); - fscanf(infile, "%s", pinyin); - fscanf(infile, "%u", &freq); + int num = fscanf(infile, "%s %s %u", + phrase, pinyin, &freq); + + if (3 != num) + continue; + if (feof(infile)) break; + feed_line(phrase, pinyin, freq); } |