/******************************************************
*
* follows begin the word get process
*
******************************************************/
bool isWord(char c)
{
if ((('a' <= c) && (c <= 'z')) || (('A' <= c) && (c <= 'Z')) || ('-' == c)) {
return true;
}
return false;
}
struct word_geter_engine {
char * buffer; /* contain the words */
char * current; /* where we reach in the buffer */
char * end; /* the last position + 1 */
int bufferSize; /* the capacity of the buffer */
char wordBuf[WORDLEN]; /* store the word have got */
bool needFill; /* indicate whether need fill the buffer */
};
bool initStorer(int capacity, struct word_geter_engine * engine)
{
engine->buffer = malloc(capacity);
if (NULL == engine->buffer) {
return false
C语言获取文件中单词并进行处理
最新推荐文章于 2024-10-16 15:16:04 发布