From 4f082982bcdb340b58454526da681169cee4fd9f Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 17 Jun 2013 14:29:29 +0800 Subject: fixes feed_file --- utils/storage/gen_pinyin_table.cpp | 10 +++++++--- 1 file 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); } -- cgit