|
|
Microsoft OS/2 SDK 03-01-1988
/*
* Example of DosGenEnv usage
*
* This call gets the addresses of the environment strings and command
* line arguments belonging to the current process
*
* Compile as: cl -AL -Lp -G0 getenv.c
*
* Created by Microsoft Corp. 1986
*/
#define INCL_DOSMISC
#include <os2def.h>
#include <bsedos.h>
main()
{
USHORT EnvSegment; /* Segment handle to the env strings */
USHORT CmdOffset; /* Offset within EnvSegment where the
command line arguments can be found */
char *arg; /* Pointer to data */
DosGetEnv(&EnvSegment,&CmdOffset); /* Get environment information */
/* Set arg to point to the environment strings */
arg = (char *)((long)EnvSegment << 16);
/* Print first environment string */
printf("Environment parameter #1: %s\n",arg);
/* Set arg to point to the command line arguments */
arg = (char *)(((long)EnvSegment << 16) + CmdOffset);
/* Print first command line argument */
printf("Command line argument #1: %s\n",arg);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.