I was afraid of that
Code:
FILE *readfile;
int lexInit(char* filename)
{
readfile = fopen(filename,"r");
if(readfile == 0)
{
printf("\nfile could not be opened\n\n");
}
else
{
printf("\n File opened\n");
}
return 0;
}
int readchar()
{
char ch;
ch = fgetc(readfile);
return ch;
}
int SkipWhiteSpace()
{
char ch;
ch = readchar();
while(isspace(ch) || ch == '/')
{
if(ch == '/')
{
ch = readchar();
if (ch == '/')
{
printf("skip line1\n");
SkiptoEndofLine();
printf("skip line2\n");
}
else
{
pushback('/');
pushback(ch);
break;
}
}
//ch = readchar();
}
pushback(ch);
return 0;
}
this is what I have so far but it doesn't work and doesn't seem wholly efficent
Code:
int SkiptoEndofLine()
{
char *trash, line[100];
trash = NULL;
fgets(trash, sizeof(line), readfile);
return 0;
}
If I could just figure out a way to skip to the next line, everytime
SkiptoTheEndofLine is called, I'd be gravy...
Well not literally