C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Running and Debugging C and C++ Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
19-4
Invocation of Constructors for Global and Static
Variables
The three standard files for ANSI-model I/O are associated to physical files:
stdin denotes the physical file specified by the IN option of the RUN command. If
you do not use the IN option, stdin denotes the command interpreter’s default input
file, which is usually your home terminal.
stdout denotes the physical file specified by the OUT option of the RUN command.
If you do not use the OUT option, stdout denotes the command interpreters default
output file, which is usually your home terminal.
stderr denotes the physical file specified in an ASSIGN STDERR command. If you
do not use the ASSIGN command, stderr denotes the command interpreter’s
default output file, which is usually your home terminal.
The IN and OUT options of the RUN command were described in Running Programs in
the Guardian Environment on page 19-1.
The ASSIGN command you use to specify the standard error file has the form:
ASSIGN STDERR, file-name
where file-name is a valid file name representing a physical file that the C compiler
can access as a text-type logical file. Note that you must enter this ASSIGN command
before you run your C program.
Invocation of Constructors for Global and Static Variables
During the startup of a C++ program, the constructors for global and static variables
are invoked. Global and static variables have storage class static, which means that
they retain their values throughout the execution of the entire program. All global
variables have storage class static. Local variables and class members can be
given storage class static by explicit use of the static storage class specifier.
Accessing Environment Information
You can access the environment information saved by the C library during program
startup:
By calling the getenv() library function
By declaring parameters to the function main()
The getenv() function enables your program to access the environment array. The
parameters to main() enable your program to access both the environment and
argument arrays. See the Guardian TNS C Library Calls Reference Manual, Guardian
Native C Library Calls Reference Manual, or the Open System Services Library Calls
Reference Manual. For more details on how to use the getenv() function; the next
subsection shows you how to declare parameters to main().