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 >
Wrap
Text File
|
1991-08-06
|
1KB
|
47 lines
/* Windows Initialization Files -- sample source code Listing 2
* Kevin H. Carlson 8/07/91
*/
.
.
.
char commPort[5];
int commBaud;
char commParity[2];
int commDataBits;
int commStopBits;
char commXferType[7];
char lpCommSection[] = "Comm";
.
.
.
/* GetProfileString returns the number of characters copied into the
* result buffer */
GetProfileString((LPSTR) lpCommSection,/* Section name */
(LPSTR) "Port", /* Key name */
(LPSTR) "COM1", /* Default */
(LPSTR) commPort, /* Result Buffer */
(LPSTR) sizeof(commPort));/* Size of Buffer including null */
/* GetProfileInt returns type WORD */
commBaud = GetProfileInt((LPSTR) lpCommSection,/* Section name */
(LPSTR) "BaudRate",/* Key name */
2400); /* Default */
GetProfileString((LPSTR) lpCommSection, (LPSTR) "Parity", (LPSTR) "N",
(LPSTR) commParity, (LPSTR) sizeof(commParity));
commDataBits = GetProfileInt((LPSTR) lpCommSection, (LPSTR) "DataBits", 8);
commStopBits = GetProfileInt((LPSTR) lpCommSection, (LPSTR) "StopBits", 1);
GetProfileString((LPSTR) lpCommSection, (LPSTR) "XferType", (LPSTR) "YModem",
(LPSTR) commXferType, (LPSTR) sizeof(commXferType));
.
.
.