| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Newbie code |
Hello All!
Enclosed is a snippet of code I am working with. I've spent
enough time lurking, and enough time reading books. Time to
actually start doing something. (Even if its wrong )
The following code fragments are supposed to open an INI file,
and find the app name and a key. It is not working as I would
expect. After a few sessions with IPMD, I am not any closer to
figuring where I went wrong .
I patched this togeather from the example code in the PMREF.
#define INCL_WINSHELLDATA /* window shell function call */
# include
int main ()
{
HINI HINI; /* returns 0 or 1 */
HAB HAB; /* anchor block */
char PSZFILENAME[13]; /* declare array size */
BOOL rc;
ULONG PDATALEN;
char PSZAPP[10]; /* array for App name */
char PSZKEY[10]; /* array for key name */
strcpy(PSZFILENAME,"KISOS2.INI"); /* copy INI name to PszFileName */
HINI = PRFOPENPROFILE(HAB,PSZFILENAME); /* open file for read/write */
printf( "This is what came back %d (HAB) %d (HINI)\n", HAB, HINI);
/* prints a set of values for HAB, and 0 for HINI */
printf("This is the content of PszFileName %s", PSZFILENAME);
strcpy(PSZAPP,"fis"); /* application name in INI */
strcpy(PSZKEY,"prog_1"); /* key name under app in INI */
rc = PRFQUERYPROFILESIZE(HINI, PSZAPP, PSZKEY, &PDATALEN);
printf("\nThe return code is %d", rc); /* prints 1 */
/* close file */
rc = PRFCLOSEPROFILE(HINI);
printf("\n\n\nThe return code is %d", rc); /* prints 0 */
return 0;
}
I get a 0 value for HINI, a 1 on the profile query function and
a 0 on the file close portion.
I know the app and key exist, but I guess I am reading the
function wrong. I am expecting it to find key and function. Yes,
the case is correct also.
Ultimately, I would like to read the INI and return the values
for the keys stored in it.
One last question. Do all the !{at}#$ variables _have_ to be in
caps? vs the above ie:
HINI hini;
HAB hab;
char pszApp
Doggone INF files are a royal pain in the you know what to read
vs an honest to gosh dead tree. But from what I gathered, with
the exception of 'char', is has to be in CAPs.
Thanks in advance!
Later!
* WCE 2.01á4/2227 * Coffee sweetened with NO-DOZ...Programmers petro!
--- WILDMAIL!/WC v4.12
* Origin: The Programmers FORUM! 704-873-4282 (1:379/1102.0)SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 379/1102 1107 1 3615/50 396/1 270/101 105/103 42 712/515 711/808 809 @PATH: 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.