Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Wierd Error message

I am using Unix and i got this wierd Error message, I dont really understand what it means, it says "expected declaration or statement at end of input" Anybody know? Here's is my code incase you need it.
Thanks in advance
#include
#include

#define STAND_ALONE 1
void count(int argc, char *argv[]);
#ifdef STAND_ALONE
void main(int argc, char *argv[])
{
count(argc,argv);
}
#endif

void count(int argc, char *argv[])
{
FILE *fp;
*++argv;
while (--argc > 0)
{
if ((fp = fopen(*++argv, "r")) == NULL)
{
printf("Unable to open file %s
", *argv);
exit(1); }
int x,y,z,line=0;
char *string = argv[1];
char buffer[250]; //LineLength
while(1)
{
y = 0;
z = 0;
fgets(buffer, 250, fp);
line++;
if (feof(fp))
break;
for (x=0;x<strlen(buffer); x++)
{
if (buffer[y]==string[z])
{ y++;
z++;
if (z==strlen(string))
printf("From file:%s
Line %d: %s",*argv,line,buffer);
}
else
{
z=0;
y++;
}

}
}
}
}

Comments

  • IDKIDK Member Posts: 1,784
    : I am using Unix and i got this wierd Error message, I dont really understand what it means, it says "expected declaration or statement at end of input" Anybody know? Here's is my code incase you need it.
    : Thanks in advance

    Format your code and post it with code tags.

    [code][leftbr]code[rightbr]

    Some code...

    [leftbr]/code[rightbr][/code]
Sign In or Register to comment.