Code:
void fileheader(char fn[],int *a )
{
int c;
FILE *fp;
fp=fopen(fn,"r");// is fn null-terminated?
while((c=getc(fp)) != '\n'); //moves filepointer pass leading newlines
while ((c=getc(fp)) == '#')//while 1st char in row is '#' ---indentation was misleading
{
while ((c=getc(fp)) != '\n');// move to next row
}
ungetc(c,fp);//unget last read??, why?? .. probably points at newline now
fscanf(fp,"%d%d%d",&a[0],&a[1],&a[2]);// is "a" defined as an array of at least 3 int? Are you reading past end of file?
fclose(fp);
}