1 /* This is part of libio/iostream, providing -*- C++ -*- input/output.
2 Copyright (C) 1993, 1997, 2000 Free Software Foundation, Inc.
4 This file is part of the GNU IO Library. This library is free
5 software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option)
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this library; see the file COPYING. If not, write to the Free
17 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 As a special exception, if you link this library with files
21 compiled with a GNU compiler to produce an executable, this does not cause
22 the resulting executable to be covered by the GNU General Public License.
23 This exception does not however invalidate any other reasons why
24 the executable file might be covered by the GNU General Public License. */
26 /* Written by Per Bothner (bothner@cygnus.com). */
29 #pragma implementation
31 #define _STREAM_COMPAT
34 #include <stdio.h> /* Needed for sprintf */
41 extern "C" int __printf_fp (_IO_FILE
*, const struct printf_info
*,
46 int __cvt_double(double number
, register int prec
, int flags
, int *signp
,
47 int fmtch
, char *startp
, char *endp
);
51 #define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */
53 //#define isspace(ch) ((ch)==' ' || (ch)=='\t' || (ch)=='\n')
55 istream::istream(streambuf
*sb
, ostream
* tied
)
61 int skip_ws(streambuf
* sb
)
66 if (ch
== EOF
|| !isspace(ch
))
71 istream
& istream::get(char& c
)
74 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
76 int ch
= _strbuf
->sbumpc();
78 set(ios::eofbit
|ios::failbit
);
86 _IO_cleanup_region_end (0);
97 if (_tie
&& rdbuf()->in_avail() == 0)
99 int ch
= _strbuf
->sgetc();
105 // [zooey]: added for R5-compatibility with bdb
106 istream
& istream::read(char *ptr
, int n
)
108 return read((char*)ptr
, (streamsize
)n
);
110 istream
& istream::read(unsigned char *ptr
, int n
)
112 return read((char*)ptr
, (streamsize
)n
);
114 istream
& istream::read(signed char *ptr
, int n
)
116 return read((char*)ptr
, (streamsize
)n
);
118 istream
& istream::read(void *ptr
, int n
)
120 return read((char*)ptr
, (streamsize
)n
);
123 istream
& istream::ignore(int n
/* = 1 */, int delim
/* = EOF */)
127 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
129 register streambuf
* sb
= _strbuf
;
131 _gcount
= sb
->ignore(n
);
136 if (n
!= MAXINT
) // FIXME
140 int ch
= sb
->sbumpc();
142 set(ios::eofbit
|ios::failbit
);
151 _IO_cleanup_region_end (0);
156 istream
& istream::read(char *s
, streamsize n
)
159 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
161 _gcount
= _strbuf
->sgetn(s
, n
);
162 if ((streamsize
)_gcount
!= n
)
163 set(ios::failbit
|ios::eofbit
);
165 _IO_cleanup_region_end (0);
175 streambuf
*sb
= rdbuf ();
178 if (sb
->sync ()) // Later: pubsync
180 setstate (ios::badbit
);
187 istream
& istream::seekg(streampos pos
)
189 pos
= _strbuf
->pubseekpos(pos
, ios::in
);
190 if (pos
== streampos(EOF
))
195 istream
& istream::seekg(streamoff off
, _seek_dir dir
)
197 streampos pos
= _IO_seekoff (_strbuf
, off
, (int) dir
, _IOS_INPUT
);
198 if (pos
== streampos(EOF
))
203 streampos
istream::tellg()
206 streampos pos
= _strbuf
->pubseekoff(0, ios::cur
, ios::in
);
208 streampos pos
= _IO_seekoff (_strbuf
, 0, _IO_seek_cur
, _IOS_INPUT
);
210 if (pos
== streampos(EOF
))
215 istream
& istream::operator>>(char& c
)
218 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
220 int ch
= _strbuf
->sbumpc();
222 set(ios::eofbit
|ios::failbit
);
226 _IO_cleanup_region_end (0);
232 istream::operator>> (char* ptr
)
234 register char *p
= ptr
;
238 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
240 register streambuf
* sb
= _strbuf
;
243 int ch
= sb
->sbumpc();
249 else if (isspace(ch
) || w
== 1)
260 _IO_cleanup_region_end (0);
266 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
267 #define LONGEST long long
272 static int read_int(istream
& stream
, unsigned LONGEST
& val
, int& neg
)
277 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
279 register streambuf
* sb
= stream
.rdbuf();
282 register int ch
= skip_ws(sb
);
289 else if (ch
== '-') {
293 if (ch
== EOF
) goto eof_fail
;
294 if (!(stream
.flags() & ios::basefield
)) {
301 if (ch
== 'x' || ch
== 'X') {
304 if (ch
== EOF
) goto eof_fail
;
313 else if ((stream
.flags() & ios::basefield
) == ios::hex
)
315 else if ((stream
.flags() & ios::basefield
) == ios::oct
)
322 if (ch
>= '0' && ch
<= '9')
324 else if (ch
>= 'A' && ch
<= 'F')
325 digit
= ch
- 'A' + 10;
326 else if (ch
>= 'a' && ch
<= 'f')
327 digit
= ch
- 'a' + 10;
338 val
= base
* val
+ digit
;
345 stream
.set(ios::failbit
);
349 stream
.set(ios::failbit
|ios::eofbit
);
353 _IO_cleanup_region_end (0);
357 #define READ_INT(TYPE) \
358 istream& istream::operator>>(TYPE& i)\
360 unsigned LONGEST val; int neg;\
361 if (read_int(*this, val, neg)) {\
362 if (neg) val = -val;\
369 READ_INT(unsigned short)
371 READ_INT(unsigned int)
373 READ_INT(unsigned long)
374 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
376 READ_INT(unsigned long long)
382 static void do_scan(istream
*istr
, const char *format
, ...)
384 streambuf
*_strbuf
= istr
->_strbuf
;
386 va_start(ap
, format
);
388 int count
= _IO_vfscanf(_strbuf
, format
, ap
, &errcode
);
389 if ((errcode
& (_IOS_EOF
|_IOS_FAIL
)) == _IOS_EOF
&& count
!= 1)
390 errcode
|= _IOS_FAIL
;
391 istr
->setstate((ios::iostate
)errcode
);
395 istream
& istream::operator>>(long double& x
)
399 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
401 #if _G_HAVE_LONG_DOUBLE_IO
402 do_scan(this, "%Lg", &x
);
405 do_scan(this, "%lg", &y
);
409 _IO_cleanup_region_end (0);
414 istream
& istream::operator>>(double& x
)
418 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
420 do_scan(this, "%lg", &x
);
422 _IO_cleanup_region_end (0);
427 istream
& istream::operator>>(float& x
)
431 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
433 do_scan(this, "%g", &x
);
435 _IO_cleanup_region_end (0);
440 istream
& istream::operator>>(register streambuf
* sbuf
)
443 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
445 register streambuf
* inbuf
= rdbuf();
446 // FIXME: Should optimize!
448 register int ch
= inbuf
->sbumpc();
453 if (sbuf
->sputc(ch
) == EOF
) {
459 _IO_cleanup_region_end (0);
464 ostream
& ostream::operator<<(char c
)
467 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
470 // This is what the cfront implementation does.
471 if (_strbuf
->sputc(c
) == EOF
) {
476 // This is what cfront documentation and current ANSI drafts say.
478 char fill_char
= fill();
479 register int padding
= w
> 0 ? w
- 1 : 0;
480 register streambuf
*sb
= _strbuf
;
481 if (!(flags() & ios::left
) && padding
) // Default adjustment.
482 if (_IO_padn(sb
, fill_char
, padding
) < padding
) {
486 if (sb
->sputc(c
) == EOF
) {
490 if (flags() & ios::left
&& padding
) // Left adjustment.
491 if (_IO_padn(sb
, fill_char
, padding
) < padding
)
496 _IO_cleanup_region_end (0);
501 /* Write VAL on STREAM.
502 If SIGN<0, val is the absolute value of a negative number.
503 If SIGN>0, val is a signed non-negative number.
504 If SIGN==0, val is unsigned. */
506 static void write_int(ostream
& stream
, unsigned LONGEST val
, int sign
)
508 #define WRITE_BUF_SIZE (10 + sizeof(unsigned LONGEST) * 3)
509 char buf
[WRITE_BUF_SIZE
];
510 register char *buf_ptr
= buf
+WRITE_BUF_SIZE
; // End of buf.
511 const char *show_base
= "";
512 int show_base_len
= 0;
513 int show_pos
= 0; // If 1, print a '+'.
515 // Now do the actual conversion, placing the result at the *end* of buf.
516 // Note that we use separate code for decimal, octal, and hex,
517 // so we can divide by optimizable constants.
518 if ((stream
.flags() & ios::basefield
) == ios::oct
) { // Octal
520 *--buf_ptr
= (val
& 7) + '0';
523 if ((stream
.flags() & ios::showbase
) && (*buf_ptr
!= '0'))
526 else if ((stream
.flags() & ios::basefield
) == ios::hex
) { // Hex
527 const char *xdigs
= (stream
.flags() & ios::uppercase
) ? "0123456789ABCDEF0X"
528 : "0123456789abcdef0x";
530 *--buf_ptr
= xdigs
[val
& 15];
533 if ((stream
.flags() & ios::showbase
)) {
534 show_base
= xdigs
+ 16; // Either "0X" or "0x".
539 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
540 // Optimization: Only use long long when we need to.
541 while (val
> UINT_MAX
) {
542 *--buf_ptr
= (val
% 10) + '0';
545 // Use more efficient (int) arithmetic for the rest.
546 register unsigned int ival
= (unsigned int)val
;
548 register unsigned LONGEST ival
= val
;
551 *--buf_ptr
= (ival
% 10) + '0';
554 if (sign
> 0 && (stream
.flags() & ios::showpos
))
558 int buf_len
= buf
+WRITE_BUF_SIZE
- buf_ptr
;
559 int w
= stream
.width(0);
561 // Calculate padding.
562 int len
= buf_len
+show_pos
;
564 len
+= show_base_len
;
565 int padding
= len
> w
? 0 : w
- len
;
568 register streambuf
* sbuf
= stream
.rdbuf();
569 ios::fmtflags pad_kind
=
570 stream
.flags() & (ios::left
|ios::right
|ios::internal
);
571 char fill_char
= stream
.fill();
573 && pad_kind
!= (ios::fmtflags
)ios::left
574 && pad_kind
!= (ios::fmtflags
)ios::internal
) // Default (right) adjust.
575 if (_IO_padn(sbuf
, fill_char
, padding
) < padding
)
577 if (sign
< 0 || show_pos
)
579 char ch
= sign
< 0 ? '-' : '+';
580 if (sbuf
->sputc(ch
) < 0)
584 if (_IO_sputn(sbuf
, show_base
, show_base_len
) <= 0)
586 if (pad_kind
== (ios::fmtflags
)ios::internal
&& padding
> 0)
587 if (_IO_padn(sbuf
, fill_char
, padding
) < padding
)
589 if ((int)_IO_sputn (sbuf
, buf_ptr
, buf_len
) != buf_len
)
591 if (pad_kind
== (ios::fmtflags
)ios::left
&& padding
> 0) // Left adjustment
592 if (_IO_padn(sbuf
, fill_char
, padding
) < padding
)
597 stream
.set(ios::badbit
);
601 ostream
& ostream::operator<<(int n
)
604 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
607 unsigned int abs_n
= (unsigned)n
;
608 if (n
< 0 && (flags() & (ios::oct
|ios::hex
)) == 0)
609 abs_n
= -((unsigned)n
), sign
= -1;
610 write_int(*this, abs_n
, sign
);
611 _IO_cleanup_region_end (0);
616 ostream
& ostream::operator<<(unsigned int n
)
619 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
621 write_int(*this, n
, 0);
622 _IO_cleanup_region_end (0);
628 ostream
& ostream::operator<<(long n
)
631 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
634 unsigned long abs_n
= (unsigned long)n
;
635 if (n
< 0 && (flags() & (ios::oct
|ios::hex
)) == 0)
636 abs_n
= -((unsigned long)n
), sign
= -1;
637 write_int(*this, abs_n
, sign
);
638 _IO_cleanup_region_end (0);
643 ostream
& ostream::operator<<(unsigned long n
)
646 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
648 write_int(*this, n
, 0);
649 _IO_cleanup_region_end (0);
654 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
655 ostream
& ostream::operator<<(long long n
)
658 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
661 unsigned long long abs_n
= (unsigned long long)n
;
662 if (n
< 0 && (flags() & (ios::oct
|ios::hex
)) == 0)
663 abs_n
= -((unsigned long long)n
), sign
= -1;
664 write_int(*this, abs_n
, sign
);
665 _IO_cleanup_region_end (0);
671 ostream
& ostream::operator<<(unsigned long long n
)
674 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
676 write_int(*this, n
, 0);
677 _IO_cleanup_region_end (0);
683 ostream
& ostream::operator<<(double n
)
686 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
688 // Uses __cvt_double (renamed from static cvt), in Chris Torek's
689 // stdio implementation. The setup code uses the same logic
690 // as in __vsbprintf.C (also based on Torek's code).
692 if ((flags() & ios::floatfield
) == ios::fixed
)
694 else if ((flags() & ios::floatfield
) == ios::scientific
)
695 format_char
= flags() & ios::uppercase
? 'E' : 'e';
697 format_char
= flags() & ios::uppercase
? 'G' : 'g';
699 int prec
= precision();
700 if (prec
<= 0 && !(flags() & ios::fixed
))
701 prec
= 6; /* default */
703 // Do actual conversion.
704 #if _G_HAVE_PRINTF_FP
706 struct printf_info info
= { /* prec: */ prec
,
707 /* width: */ width(0),
708 /* spec: */ format_char
,
709 /* is_long_double: */ 0,
712 /* alt: */ (flags() & ios::showpoint
) != 0,
714 /* left: */ (flags() & ios::left
) != 0,
715 /* showsign: */ (flags() & ios::showpos
) != 0,
717 #if defined __GLIBC__ && (__GLIBC__ >= 2 || __GLIBC__ <= -2)
719 #if __GLIBC_MINOR__ >= 1
721 #if __GLIBC_MINOR__ >= 2
729 const void *ptr
= (const void *) &n
;
730 if (__printf_fp (rdbuf(), &info
, &ptr
) < 0)
731 set(ios::badbit
|ios::failbit
);
733 #elif defined _IO_USE_DTOA
734 if (_IO_outfloat(n
, rdbuf(), format_char
, width(0),
736 flags() & ios::showpos
? '+' : 0,
738 set(ios::badbit
|ios::failbit
); // ??
740 int fpprec
= 0; // 'Extra' (suppressed) floating precision.
741 if (prec
> MAXFRACT
) {
742 if (flags() & (ios::fixed
|ios::scientific
) & ios::showpos
)
743 fpprec
= prec
- MAXFRACT
;
751 int size
= __cvt_double(n
, prec
,
752 flags() & ios::showpoint
? 0x80 : 0,
754 format_char
, cp
, buf
+ sizeof(buf
));
755 if (negative
) sign
= '-';
756 else if (flags() & ios::showpos
) sign
= '+';
760 // Calculate padding.
761 int fieldsize
= size
+ fpprec
;
762 if (sign
) fieldsize
++;
766 padding
= w
- fieldsize
;
769 register streambuf
* sbuf
= rdbuf();
771 char fill_char
= fill();
772 ios::fmtflags pad_kind
=
773 flags() & (ios::left
|ios::right
|ios::internal
);
774 if (pad_kind
!= (ios::fmtflags
)ios::left
// Default (right) adjust.
775 && pad_kind
!= (ios::fmtflags
)ios::internal
)
776 for (i
= padding
; --i
>= 0; ) sbuf
->sputc(fill_char
);
779 if (pad_kind
== (ios::fmtflags
)ios::internal
)
780 for (i
= padding
; --i
>= 0; ) sbuf
->sputc(fill_char
);
782 // Emit the actual concented field, followed by extra zeros.
783 _IO_sputn (sbuf
, cp
, size
);
784 for (i
= fpprec
; --i
>= 0; ) sbuf
->sputc('0');
786 if (pad_kind
== (ios::fmtflags
)ios::left
) // Left adjustment
787 for (i
= padding
; --i
>= 0; ) sbuf
->sputc(fill_char
);
790 _IO_cleanup_region_end (0);
795 #if _G_HAVE_LONG_DOUBLE_IO
796 ostream
& ostream::operator<<(long double n
)
800 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
803 if ((flags() & ios::floatfield
) == ios::fixed
)
805 else if ((flags() & ios::floatfield
) == ios::scientific
)
806 format_char
= flags() & ios::uppercase
? 'E' : 'e';
808 format_char
= flags() & ios::uppercase
? 'G' : 'g';
810 int prec
= precision();
811 if (prec
<= 0 && !(flags() & ios::fixed
))
812 prec
= 6; /* default */
814 #if _G_HAVE_PRINTF_FP
815 // Do actual conversion.
816 struct printf_info info
= { /* prec: */ prec
,
817 /* width: */ width(0),
818 /* spec: */ format_char
,
819 /* is_long_double: */ 1,
822 /* alt: */ (flags() & ios::showpoint
) != 0,
824 /* left: */ (flags() & ios::left
) != 0,
825 /* showsign: */ (flags() & ios::showpos
) != 0,
827 #if defined __GLIBC__ && (__GLIBC__ >= 2 || __GLIBC__ <= -2)
829 #if __GLIBC_MINOR__ >= 1
831 #if __GLIBC_MINOR__ >= 2
840 const void *ptr
= (const void *) &n
;
842 if (__printf_fp (rdbuf(), &info
, &ptr
) < 0)
843 set (ios::badbit
|ios::failbit
);
845 # error "long double I/O using dtoa or cvt_double is not implemented"
848 _IO_cleanup_region_end (0);
854 ostream
& ostream::operator<<(const char *s
)
858 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
864 // FIXME: Should we: if (w && len>w) len = w;
865 char fill_char
= fill();
866 register streambuf
*sbuf
= rdbuf();
867 register int padding
= w
> len
? w
- len
: 0;
868 if (!(flags() & ios::left
) && padding
> 0) // Default adjustment.
869 if (_IO_padn(sbuf
, fill_char
, padding
) != padding
)
874 if ((int)_IO_sputn (sbuf
, s
, len
) != len
)
879 if (flags() & ios::left
&& padding
> 0) // Left adjustment.
880 if (_IO_padn(sbuf
, fill_char
, padding
) != padding
)
884 _IO_cleanup_region_end (0);
890 ostream
& ostream::operator<<(const void *p
)
891 { Is in osform
.cc
, to avoid pulling in all of _IO_vfprintf by
this file
. */
}
894 ostream
& ostream::operator<<(register streambuf
* sbuf
)
898 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
900 char buffer
[_IO_BUFSIZ
];
901 register streambuf
* outbuf
= _strbuf
;
904 _IO_size_t count
= _IO_sgetn(sbuf
, buffer
, _IO_BUFSIZ
);
907 if (_IO_sputn(outbuf
, buffer
, count
) != count
)
914 _IO_cleanup_region_end (0);
919 ostream::ostream(streambuf
* sb
, ostream
* tied
)
924 ostream
& ostream::seekp(streampos pos
)
926 pos
= _strbuf
->pubseekpos(pos
, ios::out
);
927 if (pos
== streampos(EOF
))
932 ostream
& ostream::seekp(streamoff off
, _seek_dir dir
)
934 streampos pos
= _IO_seekoff (_strbuf
, off
, (int) dir
, _IOS_OUTPUT
);
935 if (pos
== streampos(EOF
))
940 streampos
ostream::tellp()
943 streampos pos
= _IO_seekoff (_strbuf
, 0, _IO_seek_cur
, _IOS_OUTPUT
);
945 streampos pos
= _strbuf
->pubseekoff(0, ios::cur
, ios::out
);
947 if (pos
== streampos(EOF
))
952 ostream
& ostream::flush()
959 ostream
& flush(ostream
& outs
)
964 istream
& ws(istream
& ins
)
967 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
969 int ch
= skip_ws(ins
._strbuf
);
971 ins
.set(ios::eofbit
);
973 ins
._strbuf
->sputbackc(ch
);
975 _IO_cleanup_region_end (0);
980 // Skip white-space. Return 0 on failure (EOF), or 1 on success.
981 // Differs from ws() manipulator in that failbit is set on EOF.
982 // Called by ipfx() and ipfx0() if needed.
984 int istream::_skip_ws()
986 int ch
= skip_ws(_strbuf
);
988 set(ios::eofbit
|ios::failbit
);
992 _strbuf
->sputbackc(ch
);
997 ostream
& ends(ostream
& outs
)
1003 ostream
& endl(ostream
& outs
)
1005 return flush(outs
.put('\n'));
1008 istream
& lock(istream
& ins
)
1010 _IO_flockfile (ins
._strbuf
);
1013 istream
& unlock(istream
& ins
)
1015 _IO_funlockfile (ins
._strbuf
);
1018 ostream
& lock(ostream
& outs
)
1020 _IO_flockfile (outs
._strbuf
);
1023 ostream
& unlock(ostream
& outs
)
1025 _IO_funlockfile (outs
._strbuf
);
1030 ostream
& ostream::write(const char *s
, streamsize n
)
1033 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile
,
1035 if ((streamsize
)_IO_sputn(_strbuf
, s
, n
) != n
)
1038 _IO_cleanup_region_end (0);
1043 // [zooey]: added for R5-compatibility
1044 ostream
& ostream::write(const char *s
, int n
)
1046 return write((const char*)s
, (streamsize
)n
);
1048 ostream
& ostream::write(const unsigned char *s
, int n
)
1050 return write((const char*)s
, (streamsize
)n
);
1052 ostream
& ostream::write(const signed char *s
, int n
)
1054 return write((const char*)s
, (streamsize
)n
);
1056 ostream
& ostream::write(const void *s
, int n
)
1058 return write((const char*)s
, (streamsize
)n
);
1061 void ostream::do_osfx()
1063 if (flags() & ios::unitbuf
)
1065 if (flags() & ios::stdio
) {
1071 iostream::iostream(streambuf
* sb
, ostream
* tied
)
1076 // NOTE: extension for compatibility with old libg++.
1077 // Not really compatible with fistream::close().
1078 #ifdef _STREAM_COMPAT
1081 if (_strbuf
->_flags
& _IO_IS_FILEBUF
)
1082 ((struct filebuf
*)rdbuf())->close();
1083 else if (_strbuf
!= NULL
)
1089 int istream::skip(int i
)
1091 int old
= (_flags
& ios::skipws
) != 0;
1093 _flags
|= ios::skipws
;
1095 _flags
&= ~ios::skipws
;