贴,呜呜~

求助贴,呜呜~~~~~~
我想统计文件中 中英字符出现的频数 和 保存字符  
并且 是用一个结构体 保存 字符和频数,因为汉字是两个字符表示的,但我用fgetc读取时,对汉字来说就不合适。
如果用fgets的话读取的是字符串 又如何分出 汉字和英文字符呢?
贴,呜呜~
------解决思路----------------------
记得以前好像做过类似的东西, 没记错的的话汉字两个字节的ascii值的最高位都是1,楼主可以根据判断字符的asii码值对获取的字符串所有字符进行判断,应该可以
------解决思路----------------------
Stream I/O
These functions process data in different sizes and formats, from single characters to large data structures. They also provide buffering, which can improve performance. The default size of a stream buffer is 4K. These routines affect only buffers created by the run-time library routines, and have no effect on buffers created by the operating system.

Stream I/O Routines

Routine Use 
clearerr Clear error indicator for stream 
fclose Close stream 
_fcloseall Close all open streams except stdin, stdout, and stderr 
_fdopen, wfdopen Associate stream with handle to open file 
feof Test for end of file on stream 
ferror Test for error on stream 
fflush Flush stream to buffer or storage device  
fgetc, fgetwc Read character from stream (function versions of getc and getwc) 
_fgetchar, _fgetwchar Read character from stdin (function versions of getchar and getwchar) 
fgetpos Get position indicator of stream 
fgets, fgetws Read string from stream 
_fileno Get file handle associated with stream 
_flushall Flush all streams to buffer or storage device 
fopen, _wfopen Open stream 
fprintf, fwprintf Write formatted data to stream 
fputc, fputwc Write a character to a stream (function versions of putc and putwc) 
_fputchar, _fputwchar Write character to stdout (function versions of putchar and putwchar) 
fputs, fputws Write string to stream 
fread Read unformatted data from stream 
freopen, _wfreopen Reassign FILE stream pointer to new file or device 
fscanf, fwscanf Read formatted data from stream 
fseek Move file position to given location 
fsetpos Set position indicator of stream 
_fsopen, _wfsopen Open stream with file sharing 
ftell Get current file position 
fwrite Write unformatted data items to stream 
getc, getwc Read character from stream (macro versions of fgetc and fgetwc) 
getchar, getwchar Read character from stdin (macro versions of fgetchar and fgetwchar) 
gets, getws Read line from stdin 
_getw Read binary int from stream 
printf, wprintf Write formatted data to stdout 
putc, putwc Write character to a stream (macro versions of fputc and fputwc) 
putchar, putwchar Write character to stdout (macro versions of fputchar and fputwchar) 
puts, _putws Write line to stream 
_putw Write binary int to stream 
rewind Move file position to beginning of stream 
_rmtmp Remove temporary files created by tmpfile 
scanf, wscanf Read formatted data from stdin 
setbuf Control stream buffering 
_setmaxstdio Set a maximum for the number of simultaneously open files at the stream I/O level.  
setvbuf Control stream buffering and buffer size 
_snprintf, _snwprintf Write formatted data of specified length to string 
sprintf, swprintf Write formatted data to string 
sscanf, swscanf Read formatted data from string 
_tempnam, _wtempnam Generate temporary filename in given directory 
tmpfile Create temporary file 
tmpnam, _wtmpnam Generate temporary filename 
ungetc, ungetwc Push character back onto stream 
vfprintf, vfwprintf  Write formatted data to stream 
vprintf, vwprintf Write formatted data to stdout 
_vsnprintf, _vsnwprintf Write formatted data of specified length to buffer 
vsprintf, vswprintf Write formatted data to buffer 


When a program begins execution, the startup code automatically opens several streams: standard input (pointed to by stdin), standard output (pointed to by stdout), and standard error (pointed to by stderr). These streams are directed to the console (keyboard and screen) by default. Use freopen to redirect stdin, stdout, or stderr to a disk file or a device.

Files opened using the stream routines are buffered by default. The stdout and stderr functions are flushed whenever they are full or, if you are writing to a character device, after each library call. If a program terminates abnormally, output buffers may not be flushed, resulting in loss of data. Use fflush or _flushall to ensure that the buffer associated with a specified file or all open buffers are flushed to the operating system, which can cache data before writing it to disk. The commit-to-disk feature ensures that the flushed buffer contents are not lost in the event of a system failure. 

There are two ways to commit buffer contents to disk: 

Link with the file COMMODE.OBJ to set a global commit flag. The default setting of the global flag is n, for “no-commit.”


Set the mode flag to c with fopen or _fdopen. 
Any file specifically opened with either the c or the n flag behaves according to the flag, regardless of the state of the global commit/no-commit flag.

If your program does not explicitly close a stream, the stream is automatically closed when the program terminates. However, you should close a stream when your program finishes with it, as the number of streams that can be open at one time is limited. See _setmaxstdio for information on this limit. 

Input can follow output directly only with an intervening call to fflush or to a file-positioning function (fseek, fsetpos, or rewind). Output can follow input without an intervening call to a file-positioning function if the input operation encounters the end of the file.

------解决思路----------------------
String Manipulation
These routines operate on null-terminated single-byte character, wide-character, and multibyte-character strings. Use the buffer-manipulation routines, described in Buffer Manipulation, to work with character arrays that do not end with a null character.

String-Manipulation Routines

Routine Use 
_mbscoll, _mbsicoll, _mbsncoll, _mbsnicoll Compare two multibyte-character strings using multibyte code page information (_mbsicoll and _mbsnicoll are case-insensitive) 
_mbsdec, _strdec, _wcsdec Move string pointer back one character 
_mbsinc, _strinc, _wcsinc Advance string pointer by one character 
_mbslen Get number of multibyte characters in multibyte-character string; dependent upon OEM code page 
_mbsnbcat Append, at most, first n bytes of one multibyte-character string to another 
_mbsnbcmp Compare first n bytes of two multibyte-character strings 
_mbsnbcnt Return number of multibyte-character bytes within supplied character count 
_mbsnbcpy Copy n bytes of string 
_mbsnbicmp Compare n bytes of two multibyte-character strings, ignoring case 
_mbsnbset Set first n bytes of multibyte-character string to specified character 
_mbsnccnt Return number of multibyte characters within supplied byte count 
_mbsnextc, _strnextc, _wcsnextc Find next character in string 
_mbsninc. _strninc, _wcsninc  Advance string pointer by n characters 
_mbsspnp, _strspnp, _wcsspnp Return pointer to first character in given string that is not in another given string 
_mbstrlen Get number of multibyte characters in multibyte-character string; locale-dependent 
sprintf, _stprintf Write formatted data to a string 
strcat, wcscat, _mbscat Append one string to another 
strchr, wcschr, _mbschr Find first occurrence of specified character in string 
strcmp, wcscmp, _mbscmp Compare two strings 
strcoll, wcscoll, _stricoll, _wcsicoll, _strncoll, _wcsncoll, _strnicoll, _wcsnicoll Compare two strings using current locale code page information (_stricoll, _wcsicoll, _strnicoll, and _wcsnicoll are case-insensitive) 
strcpy, wcscpy, _mbscpy Copy one string to another 
strcspn, wcscspn, _mbscspn,  Find first occurrence of character from specified character set in string 
_strdup, _wcsdup, _mbsdup Duplicate string 
strerror Map error number to message string 
_strerror Map user-defined error message to string 
strftime, wcsftime Format date-and-time string 
_stricmp, _wcsicmp, _mbsicmp Compare two strings without regard to case 
strlen, wcslen, _mbslen, _mbstrlen Find length of string 
_strlwr, _wcslwr, _mbslwr Convert string to lowercase 
strncat, wcsncat, _mbsncat Append characters of string 
strncmp, wcsncmp, _mbsncmp Compare characters of two strings 
strncpy, wcsncpy, _mbsncpy Copy characters of one string to another 
_strnicmp, _wcsnicmp, _mbsnicmp Compare characters of two strings without regard to case 
_strnset, _wcsnset, _mbsnset Set first n characters of string to specified character 
strpbrk, wcspbrk, _mbspbrk Find first occurrence of character from one string in another string 
strrchr, wcsrchr,_mbsrchr Find last occurrence of given character in string 
_strrev, _wcsrev,_mbsrev Reverse string 
_strset, _wcsset, _mbsset Set all characters of string to specified character 
strspn, wcsspn, _mbsspn Find first substring from one string in another string 
strstr, wcsstr, _mbsstr Find first occurrence of specified string in another string 
strtok, wcstok, _mbstok Find next token in string 
_strupr, _wcsupr, _mbsupr Convert string to uppercase 
strxfrm, wcsxfrm Transform string into collated form based on locale-specific information 
vsprintf, _vstprint Write formatted output using a pointer to a list of arguments 

------解决思路----------------------
做一下 汉字 和英文字符  的判断!