Thread View: mod.computers.masscomp
1 messages
1 total messages
Started by masscomp-request
Mon, 12 Jan 1987 03:31
"r+" mode doesn't work under RTU 3.1
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads