/******************************************************
*
* 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
C语言获取文件中单词并进行处理
最新推荐文章于 2022-12-21 22:50:55 发布
该博客介绍了一个使用C语言实现的读取文件单词的函数process,它能通过回调函数processer处理读取到的单词。适用于进行hash函数测试,通过自定义isWord函数筛选特定字符组成的单词。
摘要由CSDN通过智能技术生成