🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2122

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

#2122
From: Fergus James HENDERSON
Date: Mon, 12 Oct 1992 08:17
26 lines
1389 bytes
Organization: Computer Science, University of Melbourne, Australia

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: <719058360.F00015@monly.wlink.nl.wlink.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!wtrlnd!monly.wlink.nl!news-daemon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!wtrlnd!monly.wlink.nl!news-daemon
From: Fergus.James.HENDERSON@f1.n100.z60.wlink.nl (Fergus James HENDERSON)
Newsgroups: comp.std.c
Subject: FILE *yyin=stdin; not ANSI-C??
Message-ID: <719058360.F00015@monly.wlink.nl.wlink.nl>
Date: Mon, 12 Oct 1992 07:17:10 -0100
Sender: news-daemon@monly.wlink.nl.wlink.nl
Lines: 27