Xref: news-dnh.mv.net comp.os.msdos.djgpp:1617 Path: news-dnh.mv.net!mv!news.sprintlink.net!newsfeed.internetmci.com!info.ucla.edu!news.ucdavis.edu!wheel!elric From: elric AT wheel DOT dcn DOT davis DOT ca DOT us (Jeffrey Taylor) Newsgroups: comp.os.msdos.djgpp Subject: Re: BUG IN V2?? Date: 17 Aug 1995 23:11:29 GMT Organization: Davis Community Network - Davis, California, USA Lines: 31 References: Nntp-Posting-Host: wheel.dcn.davis.ca.us To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Is there any requirement for argv[1] to be dereferencable if argc == 1? If this were my program, I would guess I had gotten lucky on the OS and check before I call fopen. Bora Ertung (bertung AT gab DOT unt DOT edu) wrote: : main(int argc,char **argv) : { : FILE *yyin; : yyin=fopen(argv[1],"r"); : if(!yyin)exit(0); : } : Lets assume that our program' name is test. When we : just enter : c:\>test : Abort! : wowww..It is not suppose to be a bug at all. Because it works fine with : gcc for unix. But, 'fopen' may return 'null' if 'filename' is 'null' : instead of saying 'Abort!' because of the 'null' filename. : And of course it is pretty logical to catch null pointer assingments. : But, It was working with official version of the djgpp.May be I am just : dreaming. : Bora -- ============================================ Without my guitar, I am a poet without arms. - Michael Bloomfield ============================================