Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/clearenv.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/clearenv.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/clearenv.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/clearenv.html on line 8

clearenv()

Clear the environment

Synopsis:

#include <stdlib.h>

int clearenv( void );

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The clearenv() function clears the environment area; no environment variables are defined immediately after the clearenv() call.

Note that clearenv() clears the following environment variables, which may then affect the operation of other library functions such as spawnp():

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

ENOMEM
Not enough memory to allocate a control structure.

Examples:

Clear the entire environment and set up a new TZ environment variable:

#include <stdio.h>
#include <stdlib.h>

int main( void )
{
    if( clearenv() != 0 ) {
        puts( "Unable to clear the environment" );
        return EXIT_FAILURE;
    }

    setenv( "TZ", "EST5EDT", 0 );
    
    return EXIT_SUCCESS;
}

Classification:

QNX 4

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

Caveats:

The clearenv() function manipulates the environment pointed to by the global environ variable.

See also:

environ, errno, execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), getenv(), putenv(), searchenv(), setenv(), spawn(), spawnl(), spawnle(), spawnlp(), spawnlpe(), spawnp(), spawnv(), spawnve(), spawnvp(), spawnvpe(), system(), unsetenv()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/clearenv.html on line 214

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/clearenv.html on line 214