Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!srcsip!bthpyd!holmes
From: holmes@bthpyd.UUCP (Jim Holmes)
Newsgroups: comp.lang.c++
Subject: Questions on I/O in 2.0
Message-ID: <499@bthpyd.UUCP>
Date: 28 Sep 89 19:48:32 GMT
Reply-To: holmes@bthpyd.UUCP (Jim Holmes)
Distribution: na
Organization: Bethel College, St. Paul, MN
Lines: 75

Questions about i/o under 2.0

I am converting a medium sized project written in 1.2 to 2.0.

One of the modules is produced by a well-known scanner generator
and then passed through sed to make it valid food for CC.  So far
the i/o in this module has only cooperated with  while
all other modules are happy with either  or .

Naturally the output from the scanner is produced *along with*
output from the various other modules.  Unfortunately, all the 
scanner output is either printed  prior to any other output or
it is saved up until the (iostream) output from the
other modules is totally flushed from the buffer.  Is there
a way to coordinate the various outputs so that things are 
displayed in the order computed?

Also, is the fact that form() lives only in  significant?
The Book had over one page on it.  I couldn't find anything in Lippman
about it.  Has it fallen out of favor?

--------
Simple Example of the problem: main module
________

#include 

extern void mod1();
extern void mod2();

main() {
	cout << "illustrating message synchronizing problem\n";
	mod1();
	mod2();
}

--------
	Offending module:
________

#include
//because output by lex and conversion to iostream is a mess

void mod1() {
	printf("hello from mod1\n");
}

--------
	Cooperative modules:
________

#include
//files containing c++ stuff or stuff generated by yacc

void mod2() {
	cout << "hello from mod2\n";
}

--------
sample run
________

Script started on Thu Sep 28 14:13:41 1989
% a.out
hello from mod1
illustrating message synchronizing problem
hello from mod2
% ^D
script done on Thu Sep 28 14:13:51 1989


--------
Jim Holmes                              INTERNET    holmes@bethel.edu
Bethel College				UUCP	    amdahl!bungia!bthpyd!holmes
St. Paul, MN 55112			ATT	    (612) 638-6315