代码
struct CharList {
char *s;
CharList *next;
}*KeyWord, *SignSymbol, *CalcuSymbol, *AreaSymbol, *VarSymbol;
CharList *L = (CharList*)malloc(sizeof(CharList)), *L1, *L2;
L2 = L; L->next = NULL;
f = fopen("D:\\P\\BYYL\\SymbolTable\\MyProgram.txt", "r");
int i = 0;
char *in;
for (;; i++)
{
while (!(in = (char*)malloc(50 * sizeof(char))));
fseek(f, 50 * i, 0);
fread(in, 1, 50, f);
if (in[0] == '\0') break;
L->s = (char*)malloc(50 * sizeof(char));
strcpy(L->s, in);
free(in);
L1 = (CharList*)malloc(sizeof(CharList));
L->next = L1;
L = L1;
L->next = NULL;
}