From 20817e002894a3897f262938dba393296af10b53 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 26 Jul 2011 15:26:17 +0800 Subject: fixes stderr fprintf --- utils/storage/gen_binary_files.cpp | 8 ++++---- utils/storage/gen_pinyin_table.cpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'utils') diff --git a/utils/storage/gen_binary_files.cpp b/utils/storage/gen_binary_files.cpp index f8d3c70..5d32b58 100644 --- a/utils/storage/gen_binary_files.cpp +++ b/utils/storage/gen_binary_files.cpp @@ -30,7 +30,7 @@ int main(int argc, char * argv[]){ FILE * gbfile = fopen("../../data/gb_char.table", "r"); if ( gbfile == NULL) { - printf("open gb_char.table failed!"); + fprintf(stderr, "open gb_char.table failed!"); return 1; } @@ -42,7 +42,7 @@ int main(int argc, char * argv[]){ FILE * gbkfile = fopen("../../data/gbk_char.table","r"); if ( gbkfile == NULL) { - printf("open gb_char.table failed!"); + fprintf(stderr, "open gb_char.table failed!"); return 1; } @@ -67,7 +67,7 @@ int main(int argc, char * argv[]){ FILE* infile = fopen("../../data/gb_char.table", "r"); if ( NULL == infile ){ - printf("open gb_char.table failed!\n"); + fprintf(stderr, "open gb_char.table failed!\n"); exit(ENOENT); } @@ -76,7 +76,7 @@ int main(int argc, char * argv[]){ infile = fopen("../../data/gbk_char.table", "r"); if ( NULL == infile ){ - printf("open gbk_char.table failed!\n"); + fprintf(stderr, "open gbk_char.table failed!\n"); exit(ENOENT); } diff --git a/utils/storage/gen_pinyin_table.cpp b/utils/storage/gen_pinyin_table.cpp index 1808162..149e492 100644 --- a/utils/storage/gen_pinyin_table.cpp +++ b/utils/storage/gen_pinyin_table.cpp @@ -138,7 +138,8 @@ void feed_line (const char * phrase, const char * pinyin, const guint32 freq){ * where is the code which I don't want to touch. :-) */ if (new_phrase_ptr->length >= MAX_PHRASE_LENGTH ) { - printf("too long phrase:%s\t%s\t%d\n", phrase, pinyin, freq); + fprintf(stderr, "too long phrase:%s\t%s\t%d\n", phrase, + pinyin, freq); free(new_phrase_ptr); return; } @@ -160,7 +161,7 @@ void feed_line (const char * phrase, const char * pinyin, const guint32 freq){ value_item.freq = freq; if(new_phrase_ptr->length != value_item.pinyin->len){ - printf("error:phrase:%s\tpinyin:%s\n", phrase, pinyin); + fprintf(stderr, "error:phrase:%s\tpinyin:%s\n", phrase, pinyin); return; } -- cgit