problems with fopen() in c programs when compiled with cc and gcc

sinam dhiren sdkhuman@yahoo.com
Tue Mar 20 02:06:00 GMT 2001


Hi,
	I am using RED HAT LINUX version 7,when I compile the
following program using cc as well as gcc cmmpilers I
get the warning messages as followed.Please help me
with the problem.
	The program is as follows
/*this file printfile prints a file */
#include <stdio.h>
main(int argc,char *argv[])
{
   FILE *fp;
   int c;
    if (argc==2){
       if ((fp=fopen(argv[1],"r"))!=NULL)
           while ((c=getc(fp))!=EOF)
                 putchar(c);
    }   
}

	The error message I got is as follows
printfile.c:In Function 'main':
printfile.c:8:warning:assignment makes pointer from
integer without a cast

	Also provide some information about 
"Segmentation fault  core(dumped)"

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



More information about the Gcc-help mailing list