X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com Date: Sat, 20 Jul 2013 17:33:50 +0300 From: Eli Zaretskii Subject: Re: Set _IOERR if the file stream has been opened in wrong mode. In-reply-to: <878v11qpwa.fsf@uwakimon.sk.tsukuba.ac.jp> X-012-Sender: halo1 AT inter DOT net DOT il To: djgpp-workers AT delorie DOT com Message-id: <83r4etxpv5.fsf@gnu.org> References: <51E5D0C6 DOT 1060404 AT gmx DOT de> <83y5951a79 DOT fsf AT gnu DOT org> <51E702E0 DOT 3010809 AT gmx DOT de> <83fvvc1t0x DOT fsf AT gnu DOT org> <8738rcsdik DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <201307180459 DOT r6I4xWxV010383 AT envy DOT delorie DOT com> <51E9D758 DOT 8000209 AT gmx DOT de> <87fvv9r6ba DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <8361w5zl86 DOT fsf AT gnu DOT org> <87a9lhqz60 DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <83wqolxy5m DOT fsf AT gnu DOT org> <878v11qpwa DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Stephen J. Turnbull" > Date: Sat, 20 Jul 2013 23:15:01 +0900 > > Can you read from a (FILE*|file descriptor) opened in mode 'w' in a > DJGPP program? You get EOF if you do. > I would assume that the designers wanted to avoid situations where > FILE* or fd is passed around and somebody gets confused and overwrites > a file that was supposed to be readonly. DJGPP supports this by returning EOF in both "read from ofp" and "write to ifp" scenarios. So it effectively prohibits both, as you'd expect. The issue is something else: whether ferror should return true or false after you try those scenarios.