![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS/C C++ Development System User's Guide, Release 6.50 |
This section explains
how the SAS/C implementation relates to releases of AT&T C++ and discusses
some considerations for developing C++ programs that will adapt easily to
the future directions of C++.
The streams library is fully compatible with the AT&T Release 2 streams
library. One exception is that member functions that refer to file descriptors
and to other aspects of U NIX low-level I/O, such as
fd()
and
attach()
, have not been implemented.
The C++ streams library was redefined after the first release, and the
Release 2 version is somewhat incompatible with Release 1. (Release 1 is described
in Stroustrop's book, The C++ Programming Language, First Edition.)
The SAS/C C++ Development System implements the old Release 1 streams library
for compatibility with old programs, if you include the old header file
stream.h
. However, this usage is obsolete
and will probably be removed from the library at some point.
The
functions, constants, and types defined in the
stream.h
header file are provided
for compatibility with older versions of some C++ I/O libraries and may not
be supported by future versions of the SAS/C C++ I/O library.
All of the functions declared in this header file share an internal
static
data area and return a pointer to this data area. Each call
to any of these functions overwrites this data area.
Here are the contents of the
stream.h
header file:
char* form(char *format, . . .)
;printf
style formatting of character strings. The
format
string is the same as the format string for the C
printf
function. (See the description of
printf
in the SAS/C Library
Reference, Volume 1 for more information.) The number and type of the
arguments following the
format
argument are controlled by the
format
string.char* oct(long value, int size = 0)
;
char* hex(long value, int size = 0)
;
char* dec(long
value, int size = 0)
;
char* chr(long value, int size = 0)
;
char* str(char *value, int size = 0)
;value
into a string and return a pointer to the
string.
The following list describes each function in more detail:
size
is zero, the returned string is exactly as
long as needed to represent the value of
1
. Otherwise, if
size
is less
than the length of the converted value, the converted value is truncated on
the right. If
size
is greater than the length of the converted value, spaces are
added to the left of the converted value.istream& WS(istream& i)
;
void eatwhite(istream& i)
;i
past any white space. If the current
character of
i
is not
a white space character, these functions do nothing. A white space character
is any character for which the macro
isspace
returns true. See the SAS/C Library Reference, Volume 1
for a description of
isspace
. const int input = ios::in;
const int output = ios::out;
const int append = ios::app;
const int atend = ios::ate;
const int _good = ios::goodbit;
const int _bad = ios::badbit;
const int _fail = ios::failbit;
const int _eof = ios::eofbit;ios::
style names should be used in new programs.
See enum io_state
for details on each constant.typedef ios::io_state state_value;state_value
) for what is now defined
as
ios::io_state
. See enum io_state
for details on
ios::io_state
.ANSI Committee X3J16
is currently working on an official standard for C++, including the streams
library. As this work proceeds, it is very likely that there will be additional
changes in the specifications of the streams library, some of which may cause
existing programs to fail. It is therefore recommended that C++ streams applications
should be kept relatively simple, to lessen the chances of disturbance by
redefinition of some of the more obscure parts
of the library. Especially, we recommend that you avoid deriving from the
streambuf
classes, as this interface is infrequently used and is
expected to be volatile.
Note: There is not yet an ANSI Standard for C++, but when one is developed,
the SAS/C C++ Development System will comply with this Standard. At such time,
ANSI compatibility will take precedence over compatibility with the C++ language
described in The C++ Programming Language.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © Tue Feb 10 12:11:23 EST 1998 by SAS Institute Inc., Cary, NC, USA. All rights reserved.