|
|
1.1 root 1: . \"ident "%W%"
2: . \"Copyright (c) 1984 AT&T
3: . \"All Rights Reserved
4: . \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
5: . \"The copyright notice above does not evidence any
6: . \"actual or intended publication of such source code.
7: .TH STRSTREAM 3I+ "C++ Stream Library" " "
8: .SH NAME
9: strstream \- iostream specialized to arrays
10: .SH SYNOPSIS
11: .ta 1i 2i
12: .ft B
13: .nf
14:
15: #include <strstream.h>
16:
17: class ios {
18: public:
19: enum open_mode { in, out, ate, app } ;
20: // \fIand lots of other stuff ... \fP
21: } ;
22:
23: class istrstream : public istream {
24: public:
25: istrstream(char*) ;
26: istrstream(char*, int) ;
27: strstreambuf* rdbuf() ;
28: } ;
29:
30: class ostrstream : public ostream {
31: public:
32: ostrstream();
33: ostrstream(char*, int, open_mode = 0) ;
34: int pcount() ;
35: char* str();
36: strstreambuf* rdbuf() ;
37: };
38:
39: .fi
40: .ft R
41: .SH DESCRIPTION
42: \f(CWstrstream\fR specializes \f(CWiostream\fR
43: for "incore" operations, that is, storing and fetching
44: from arrays of bytes. The \f(CWstreambuf\fR associated with a
45: \f(CWstrstream\fR is a \f(CWstrstreambuf\fR.
46: .PP
47: Assume
48: .br
49: \(em \fBiss\fR is a \f(CWistrstream\fR.
50: .br
51: \(em \fBoss\fR is a \f(CWostrstream\fR.
52: .br
53: \(em \fBcp\fR is a \f(CWchar*\fR.
54: .br
55: \(em \fBmode\fR is an \f(CWopen_mode\fR.
56: .br
57: \(em \fBi\fR and \fBlen\fR are \f(CWint\fR.
58: .br
59: \(em \fBssb\fR is a \f(CWstrstreambuf*\fR.
60: .br
61: \(em \fBa\fR is a \f(CWvoid* (*)(long)\fR.
62: .br
63: \(em \fBf\fR is a \f(CWvoid (*)(void*)\fR.
64: .PP
65: The constructors:
66: .TP
67: \fBistrsteam(cp)\fR
68: Characters will be fetched from the (null terminated) string
69: \fBcp\R. The terminating null character will not be part of
70: the sequence. Seeks are allowed within that space.
71: .TP
72: \fBistrstream(cp,len)
73: Characters will be fetched from the array beginning at \fBcp\fR
74: and extending for \fBlen\fR bytes.
75: Seeks are allowed anywhere
76: within that array.
77: .TP
78: \fBostrstream()\fR
79: Space will be dynamically allocated to hold stored characters.
80: .TP
81: \fBostrstream(cp,n,mode)\fR
82: Characters will be stored into the array starting at \fBcp\fR
83: and continuing for \fBn\fR bytes. If \f(CWios::ate\fR or
84: \f(CWios::append\fR is set in \fBmode\fR, \fBcp\fR is assumed
85: to be a null terminated string and storing will begin at the
86: null character. Otherwise storing will begin at \fBcp\fR.
87: Seeks are allowed anywhere in the array.
88: Members:
89: .TP
90: \fBcp=oss.str()\fR
91: Returns a pointer to the array being used.
92: If \fBoss\fR was constructed with an explicit array,
93: \fBcp\fR is just a pointer to the array. Otherwise,
94: \fBcp\fR points
95: to a dynamically allocated area.
96: Until \fBstr\fR is called, deleting the dynamically allocated area is
97: the responsibility of \fBss\fR.
98: After \fBstr\fR returns, the array becomes the responsibility
99: of the user program.
100: Once \fBstr\fR has been called the effect of storing
101: more characters into \fBss\fR is undefined.
102: .TP
103: \fBi=ss.pcount()\fR
104: The number of bytes that have been stored into the buffer.
105: This is mainly of use when binary data has been
106: stored and \fBss.str()\fR does not point to
107: a null terminated string.
108: .SH SEE ALSO
109: strstreambuf(3C++),
110: iostream(3C++)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.