home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_11 / 2n11045a < prev    next >
Text File  |  1991-08-06  |  1KB  |  47 lines

  1. /*  Windows Initialization Files -- sample source code Listing 2
  2.  *  Kevin H. Carlson  8/07/91
  3.  */
  4.  
  5.  
  6. .
  7. .
  8. .
  9. char      commPort[5];
  10. int       commBaud;
  11. char      commParity[2];
  12. int       commDataBits;
  13. int       commStopBits;
  14. char      commXferType[7];
  15. char      lpCommSection[] = "Comm";
  16.  
  17.  
  18. .
  19. .
  20. .
  21. /* GetProfileString returns the number of characters copied into the
  22.  * result buffer */
  23. GetProfileString((LPSTR) lpCommSection,/* Section name */
  24.            (LPSTR) "Port",    /* Key name */
  25.            (LPSTR) "COM1",    /* Default */
  26.            (LPSTR) commPort,  /* Result Buffer */
  27.            (LPSTR) sizeof(commPort));/* Size of Buffer including null */
  28.  
  29. /* GetProfileInt returns type WORD */
  30. commBaud = GetProfileInt((LPSTR) lpCommSection,/* Section name */
  31.                (LPSTR) "BaudRate",/* Key name */
  32.                2400);         /* Default */
  33.  
  34. GetProfileString((LPSTR) lpCommSection, (LPSTR) "Parity", (LPSTR) "N",
  35.            (LPSTR) commParity, (LPSTR) sizeof(commParity));
  36.  
  37. commDataBits = GetProfileInt((LPSTR) lpCommSection, (LPSTR) "DataBits", 8);
  38.  
  39. commStopBits = GetProfileInt((LPSTR) lpCommSection, (LPSTR) "StopBits", 1);
  40.  
  41. GetProfileString((LPSTR) lpCommSection, (LPSTR) "XferType", (LPSTR) "YModem",
  42.            (LPSTR) commXferType, (LPSTR) sizeof(commXferType));
  43.  
  44. .
  45. .
  46. .
  47.