|
|
1.1 root 1: /* 1.1.1.2 ! root 2: * Example of DosGenEnv usage 1.1 root 3: * 4: * This call gets the addresses of the environment strings and command 5: * line arguments belonging to the current process 6: * 1.1.1.2 ! root 7: * Compile as: cl -AL -Lp -G0 getenv.c 1.1 root 8: * 1.1.1.2 ! root 9: * Created by Microsoft Corp. 1986 1.1 root 10: */ 11: 1.1.1.2 ! root 12: #define INCL_DOSMISC ! 13: ! 14: #include <os2def.h> ! 15: #include <bsedos.h> 1.1 root 16: 17: main() 18: { 1.1.1.2 ! root 19: USHORT EnvSegment; /* Segment handle to the env strings */ ! 20: USHORT CmdOffset; /* Offset within EnvSegment where the ! 21: command line arguments can be found */ ! 22: char *arg; /* Pointer to data */ 1.1 root 23: 1.1.1.2 ! root 24: DosGetEnv(&EnvSegment,&CmdOffset); /* Get environment information */ 1.1 root 25: 26: /* Set arg to point to the environment strings */ 27: arg = (char *)((long)EnvSegment << 16); 28: 29: /* Print first environment string */ 30: printf("Environment parameter #1: %s\n",arg); 31: 32: /* Set arg to point to the command line arguments */ 33: arg = (char *)(((long)EnvSegment << 16) + CmdOffset); 34: 35: /* Print first command line argument */ 36: printf("Command line argument #1: %s\n",arg); 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.