Help

Hannes Lubich lubich at ethz.UUCP
Mon Nov 17 03:27:02 AEST 1986


Well, I'm trapped.
When using something like :

 while (fgets (teststring, 100, myfptr) != NULL)
       if (do_something_with_string (teststring)) {
	  fclose (myfptr);
	  return 1;
       }
 fclose (myfptr);
 return 0;

I get 'Illegal instruction' when returning (both 1 and 0), if 
the filesize is greater than 0 (but the string which is read from
file is correct).
When the filesize is 0 the return works correct but it's not too
useful then.

Furthermore when I declare teststring as : char teststring[];
the above result appears but when I try to declare it as
char *teststring; I get a 'Bus error' at once.

Could somebody give me a hint about that misterious 'fgets' ?

Thanks
	Hannes
	{known world}!cernvax!ethz!lubich



More information about the Comp.lang.c mailing list