🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2114

Re: FILE *yyin=stdin; not ANSI-C??

#2114
From: Fergus James HENDERSON
Date: Mon, 12 Oct 1992 05:17
24 lines
1509 bytes
jos@and.nl (Jos Horsmeier) writes:

>You're right, but the ANSI C standard _does_ `promise' that stdin and
>stdout are `expressions of type ``pointer to FILE'' that point to the
>FILE objects associated [...]'
>So, the original poster can solve his/her problem by moving the assignments
>away from the initialization code and simply do an assignment like:
>
>FILE *yyin, *yyout;
>/* ... */
>yyin= stdin; yyout= stdout;

These initializations actually come from the "lex" tokenizer skeleton code;
to solve the problem you need to add
	if (!yyin) yyin = stdin;
	if (!yyout) yyout = stdout;
either at the start of yylex(), or more efficiently in the initialization
code which (in my version) is in yylook().

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
Technical Details
Message-ID: <9228615.20954@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!usc!sdd.hp.com!think.com!rpi!batcomputer!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
References: <1992Oct8.220811.7882@utwente.nl> <Bvv6Gn.KEn@zoo.toronto.edu> <3586@dozo.and.nl>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!usc!sdd.hp.com!think.com!rpi!batcomputer!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: FILE *yyin=stdin; not ANSI-C??
Message-ID: <9228615.20954@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
References: <1992Oct8.220811.7882@utwente.nl> <Bvv6Gn.KEn@zoo.toronto.edu> <3586@dozo.and.nl>
Date: Mon, 12 Oct 1992 05:17:10 GMT
Lines: 24