C Source Code for ENVIRON.EXE

/*******************************************************\
 *  Program name: ENVIRON.C                            *
 *  Created     : 5. May 1990                          *
 *  Revised     :                                      *
 *  Author      : Bernd Westphal                       *
 *  Purpose     : Get DOS environment size for VDM lab *
 *  Compile     : cl environ.c                         *
 *  Input param : none                                 *
\*******************************************************/

#include <stdio.h>
#include <string.h>
#include <ctype.h>

void main(argc, argv, envp)
   int   argc;
   char *argv[];
   char *envp[];
{
   int   charcount = 0;                    /* # of char  */

   printf("Current environment settings:\n\n");
   printf("-----------------------------\n");
   while (*envp)
   {
      printf("%s\n", *envp);
      charcount += strlen (*envp) + 1;     /* add 1 for the string terminator */
      *envp++;
   }
   printf("-----------------------------\n");
   printf("\nTotal environment size is %d bytes.\n\n", charcount);
   printf("Press Enter to continue ...\n");
   getchar();
}


[Back: QENV.BAT Batch File]
[Next: INT19.BAS Source Code]