home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l350 / 3.ddi / EXAMPLES / C / PRINTENV.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-04  |  554 b   |  28 lines

  1. //
  2. // PRINTENV.C -- Print the environment strings
  3. //
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <pharlap.h>
  7. int main()
  8. {
  9.     CONFIG_INF config;
  10.     UCHAR buf[256];
  11.     FARPTR pEnv;
  12.  
  13. //
  14. // Read the strings from the environment segment in a 
  15. // compiler-independent fashion.
  16. //
  17.     _dx_config_inf(&config, buf);
  18.     FP_SET(pEnv, 0, config.c_env_sel);
  19.     printf("Environment strings:\n");
  20.     while (PeekFarByte(pEnv) != 0)
  21.     {
  22.         ReadFarString(buf, pEnv);
  23.         printf("   %s\n", buf);
  24.         FP_INCR(pEnv, strlen((const char *)buf) + 1);
  25.     }
  26.     return 0;
  27. }
  28.