summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-06-17 14:29:29 +0800
committerPeng Wu <alexepico@gmail.com>2013-06-17 14:29:29 +0800
commit4f082982bcdb340b58454526da681169cee4fd9f (patch)
treef85412da7a25739fd9c54b818c4949a8b94dce27 /utils
parentd835872ca31186eb743d23e6ac51e4b86bfb023d (diff)
downloadlibpinyin-4f082982bcdb340b58454526da681169cee4fd9f.zip
libpinyin-4f082982bcdb340b58454526da681169cee4fd9f.tar.gz
libpinyin-4f082982bcdb340b58454526da681169cee4fd9f.tar.xz
fixes feed_file
Diffstat (limited to 'utils')
-rw-r--r--utils/storage/gen_pinyin_table.cpp10
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);
}