How to Print content of Environment variables

The following program shows how to achieve this:

main( int argc, char *argv[ ], char *env[ ] )
{
int i = 0 ;
clrscr( ) ;
while ( env[ i ] )
printf ( "\n%s", env[ i++ ] ) ;
}

main( ) has the third command line argument env, which is an array of pointers to the strings. Each pointer points to an environment variable from the list of environment variables.

No comments:

Post a Comment

comment on this post

Note: Only a member of this blog may post a comment.