home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: <stdio.h> and <iostream.h>
- Message-ID: <1992Sep3.170037.14131@taumet.com>
- Organization: TauMetric Corporation
- References: <1SEP199214472267@cnsvax.uwec.edu> <1992Sep2.180230.1427@lucid.com>
- Date: Thu, 3 Sep 1992 17:00:37 GMT
- Lines: 26
-
- jss@lucid.com (Jerry Schwarz) writes:
-
- >The problems with mixing stdio and iostream is one of syncronization.
- >That is since stdio and iostream are each doing their own buffering ...
-
- >If you can arrange for flush to be called at appropriate points
- >there is never any problem.
-
- This is OK for output, but you will still have problems with input
- (which was not the original question). For example, this code will
- produce bizarre results if input is from a file:
-
- int i, j;
- while( ... ) {
- cin >> i;
- scanf("%d", &j);
- ...
- }
-
- As Jerry and I both noted, you can call ios::sync_with_stdio() first
- to allow mixing. It is probably best to avoid mixing stdio and
- iostream I/O on the same file.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
- Vice Chair, ANSI C++ Committee, X3J16
-