I am about to code a tokenizer, and I am actually surprised, I have managed to do a compilable code :D but I have a problem I don't know how to solve.
I start with making an array[WORD_MAX_SIZE]={0}
. After I use fopen *'r'
. Word max size is global defined.
My program is running fine and I get the out I want, but I want to change a thing, but I don't know how. I print the result out to the screen in the end of my While loop. But I want to save the full result in one string
. Instead of printing it, I would like it in a stringset, so I can play with it later. Can anyone help?
Thanks in advance.
while (feof(fp)==0)
{
c=fgetc(fp);
if(isalpha(c))
{
array[i]=c;
i++;
}
else if (i!=0)
{
array[i]='\0';
i=0;
printf("%s\n", array);
}
}
fclose(fp);
return 0;