read a file wich fscanf() in a function

I use fopen, fscanf, fclose to read a file. It can work well. since many files should be read, a function is created with the same code. But in the function, fscanf can not work well.

for example, the first line of the the file is: > filename
but the fscanf will give: 207/23/eee/34
it appears to be a random address

Is it due to the function stack? Wish our guru to give some guidance

thanks

This will read a text file

#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
   if(argc > 1)
   { 
      char tmp[256]={0x0};
      FILE *in=fopen(argv[1], "r");
      if(in==NULL)
      {
           perror("Error opening input file")
           exit(1);
      }
      while (fgets(tmp, sizeof(tmp), in)!=NULL) printf("%s", tmp);
      if(feof(in) )
      {
               fclose(in);
               return 0;
       }    
       perror("File I/O error");
   }
   return 1;
}

regardless of format - fscanf is designed for reading in a file with a known format.
Without your code we cannot tell what is wrong.

I have solved the problem. Thanks