Article View: mod.computers.masscomp
Article #88"r+" mode doesn't work under RTU 3.1
From: masscomp-request
Date: Mon, 12 Jan 1987 03:31
Date: Mon, 12 Jan 1987 03:31
29 lines
1705 bytes
1705 bytes
Someone came to me with a problem with opening a file for reading and
writing with fopen (file, "r+"). Seems you can't write it. This is
true in both the att and ucb universes. It turns out that this is a
System V bug, even though it's in ucb as well.
I found a workaround in the 2.11 news source, file control.c:
#if defined(USG) || defined(MG1)
/*
* U G L Y K L U D G E
* This utter piece of tripe is the only way I know of
* to get around the fact that ATT BROKE standard IO
* in System 5.2. Basically, you can't open a file for
* "r+" and then try and write to it. This hack works
* on all "real" USG Unix systems, It will probably
* break on some obscure look alike that doesnt use the
* real ATT stdio.h
* also broken in WCW MG-1 42nix 2.0
* Don't blame me, blame ATT. stdio should have
* already done the following line for us, but it didn't
*/
actfp->_flag |= _IOWRT;
#endif /* USG */
That is, set the write-enable bit manually.
--
- Joe Buck {hplabs,ihnp4,sun}!oliveb!epimass!jbuck HASA (A,S)
Entropic Processing, Inc., Cupertino, California
Technical Details
Message-ID:
<2758@soma.bcm.tmc.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!princeton!allegra!ulysses!cbosgd!soma!masscomp-requestShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!princeton!allegra!ulysses!cbosgd!soma!masscomp-request From: masscomp-request@soma.UUCP Newsgroups: mod.computers.masscomp Subject: "r+" mode doesn't work under RTU 3.1 Message-ID: <2758@soma.bcm.tmc.edu> Date: Sun, 11-Jan-87 22:31:19 EST Article-I.D.: soma.2758 Posted: Sun Jan 11 22:31:19 1987 Date-Received: Mon, 12-Jan-87 23:25:36 EST Sender: masscomp@soma.bcm.tmc.edu Organization: Entropic Processing, Inc., Cupertino, CA Lines: 29 Approved: masscomp@soma.uucp