CPallini is right. But to be more clear, see the following piece of code. It includes some comments and advices. you can change it according to your needs. I haven't tested the code, but I think there won't be any core dump (if it compiles successfully :) ).
const int BUFF_SIZE = 256;
void grab_token()
{
char a;
int i = 0;
while((a = fgetc(source_FILE))!=EOF) {
if(a == ' ' || a == '\t' || a == '\r' || a == '\n')
continue;
break;
}
if(a==EOF) {
token[0]=0;
return;
}
while((a = fgetc(source_FILE))!=EOF) {
if(a == ' ' || a == '\t' || a == '\r' || a == '\n')
break;
if(i<BUFF_SIZE-2)
token[i++]=a;
else {
}
}
token[i]=0;
}