ID Number: Q11997
3.00 4.00 5.00 5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a
MS-DOS | OS/2
Summary:
This article discusses how to modify the PROMPT environment variable
in a spawned process with Microsoft C versions 5.0, 5.1, 6.0, 6.0a,
6.0ax, and C/C++ version 7.0. Use this as a guide to modify any
environment variable in a spawned process.
More Information:
Because PROMPT is an MS-DOS and OS/2 environment variable, you just
need to set your own value for PROMPT in the spawned process's
environment. C allows you to specify the environment to be handed to a
child process in one of the following two ways:
- Use one of the spawn*e() functions. See the C run-time library
reference or online help supplied with your compiler for specific
details about the spawn() family of functions.
- Use the putenv() function to modify the program's own local copy of
the environment, then use one of the spawn() functions other than
spawn*e(). Details on the putenv() function may also be found in
the C run-time library reference or online help.
In general, a process may only alter the environment to be handed to a
child process. The C run-time library functions give the illusion of
being able to alter the environment space but this is accomplished by
making a copy of the environment strings during start up and,
thereafter only altering this copy.
Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00