/******************************************************
*
* 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-04-15 21:59:19 发布
该博客介绍了一个使用C语言实现的读取文件单词的函数process,它能通过回调函数processer处理读取到的单词。适用于进行hash函数测试,通过自定义isWord函数筛选特定字符组成的单词。

最低0.47元/天 解锁文章
864

被折叠的 条评论
为什么被折叠?



