TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Keith Thomson
from: Stefan Nobis
date: 1996-05-31 11:16:00
subject: profile

At 27.05.96 Keith Thomson squeezed among other things this out of his/her keyboard:

 KT> What would be preferable, and wouldn't even need a reboot, Would be for

What about just putting the INI-File where the EXE-File exists. It's very
simple to get the path to the EXE and then put the INI also in that
directory. I do it this way:

------------------------- Schnipp -------------------------
/**************************************************************************
 *
 *  Name       :  getPath
 *
 *  Description:  get the path to the program
 *
 *  Parameters :  prog - (IN) argv[0]... not used, i has to change it
 *                path - (OUT) path to exe with ending '\'
 *                          On ERROR: NULL-string
 *                file - (OUT) pure name of the exe without extension
 *                          On ERROR: NULL-string
 *
 *  Return     :  [none]
 *
 *************************************************************************/

void getPath(char *prog, char *path, char *file)
{
    APIRET rc = 0;
    PPIB pib = NULL;
    PTIB tib = NULL;
    ULONG len = 0;
    char filePath[CCHMAXPATH] = "",         
         *p = NULL,                         
         *p2 = NULL;

    strcpy(path, "");                       // on error return
    strcpy(file, "");                       // empty strings
    rc = DosGetInfoBlocks(&tib, &pib);
    rc += DosQueryModuleName(pib->pib_hmte,
                             CCHMAXPATH,
                             filePath);
    if (rc != 0)
        return;
    p = strrchr(filePath, '\\');            // find last backslash
    if (p == NULL)
        return;
    p++;
    len = p - filePath;                     // length of the path
    memcpy(path, filePath, len);            // copy path with slash
    path[len] = '\0';
    p2 = strrchr(p, '.');                   // find last extension (.EXE)
    if (p2 == NULL)
        return;
    len = p2 - p;                           // namelength
    memcpy(file, p, len);
    file[len] = '\0';
} /****************** End of getPath() ******************/
------------------------- Schnapp -------------------------

 TB>>> 2) I much prefer to use text mode .INI files for easier editing.

 AG>> I wish IBM had done this ... its about the only good feature of 'some
 AG>> competetitive products'.

I don't think so. IBM should just a good INI-Editor to the system - in
general i prefer binary profiles.

Until the next mail...,

Stefan.
http://www.ruhr.de/home/acme2/
PGP fingerprint =  95 1E A4 B5 ED FB 78 EC  8C B9 D5 36 20 FB 23 68
!Achtung: Neuer Key!

---
* Origin: ACME Development +49-231-523397 (VFC,OS/2) (2:2444/1404)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1
@PATH: 2444/1404 8000 5 24/888 396/1 270/101 712/515 711/808 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™.