Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!bbn!bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: comp.lang.c Subject: Re: File descriptors and streams and .. Message-ID: <1677@fig.bbn.com> Date: 18 Apr 89 00:57:23 GMT References: <1743@leah.Albany.Edu> <207600018@s.cs.uiuc.edu> Organization: BBN Systems and Technologies Corporation Lines: 18 In <207600018@s.cs.uiuc.edu> carroll@s.cs.uiuc.edu writes: > why can't you switch stdin by having another variable >FILE *tmp; >and doing >tmp = stdin; stdin = my_file; do_stuff(); stdin = tmp; Because |stdin| is not required to be an lvalue. On many standard i/o implementations you have this in : #define stdin &_iob[0] and that means |stdin| can't appear on the left side of an assignment statement. This was mentioned in K&R1 and (I believe) is also allowable in ANSI and Posix. (For those who care, on VMS stdin/stdout/stderr are variables; this makes most lex output uncompileable without massaging.) /r$ -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.