Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!uupsi!fozzie!stanley From: stanley@phoenix.com (John Stanley) Newsgroups: comp.lang.c Subject: Re: When will fopen fail? Message-ID: Date: 17 Apr 91 07:35:16 GMT References: <1991Apr17.202735.12427@ux1.cso.uiuc.edu> Organization: Mad Scientist Lines: 29 gordon@osiris.cso.uiuc.edu (John Gordon) writes: > markh@csd4.csd.uwm.edu (Mark William Hopkins) writes: > > > > Assuming all the subdirectories are there and writeable (on UNIX or > >MS-DOS), when does > > > FP = fopen("...", "w"); > > >fail and return FP == NULL? > > Well, it could fail if the process has reached the limit of > simultaneous open files. Or if the filename is not valid. Aye to both. > Or if the > filename is actually a device. Only if the device is read-only, or no access, for the user, or if it is a non-character device (for UNIX). Other failures: no disk space. no more inodes. (maybe) file exists and is not writable. Perhaps we should be asking "why do you ask?" Is this a case of some code you have written failing and you want us to debug it? If so, I suggest you add a test for FP and user perror() to report the actual problem.