dividewords.c
来自「编译原理的词法分析模块」· C语言 代码 · 共 52 行
C
52 行
#include <stdio.h>#include "list/list.h"#include "common.h"#include <string.h>int main(char **avgs, int avgc){ List myList,*pList; FILE *fp; char c,buff[1024],*pb,c1[2]; pb = buff; pList = &myList; CreateList(pList); //printf("%s \n",*avgs); //getchar(); fp = fopen("text1.txt","r"); if(!fp) Error("open file error.\n"); *pb = 0; c1[1] = 0; printf(">> \n"); while(!feof(fp)) { c = fgetc(fp); if(strchr("\n\a\t ",c) > 0) { InsertListNode(pList->count,buff,pList); pb = buff; *pb = '\0'; } else if(strchr("~!@#$%^&*()+|`-=\\[{]};:'\",<.>/?",c) >0) { InsertListNode(pList->count,buff,pList); pb = buff; *pb = c; *(pb + 1) = '\0'; InsertListNode(pList->count,buff,pList); pb = buff; *pb = 0; } else { *(pb++) = c; *pb = '\0'; } } ShowListEntry(pList); getchar(); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?