C - Clear the enviroment

9. March 2012 21:30

 

A short example to show how to clear all enviroment variables from a C program using the libc function clear env.

 

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

int main(int argc, char **argv) {

	clearenv();

	system("env");
	return 0;
}

E-mail Kick it! DZone it! del.icio.us Permalink