TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Jason Meaden
date: 1995-05-14 00:09:24
subject: DosExecPgm

G'Day All,

Ok, it's midnight and I can't see what is wrong with the following code fragment;

void SqUnPack(void)
{
    cout << "You have selected SqUnPack " << endl;

    CHAR           LoadError[100];
    char           Args[10];
    PSZ            Envs;
    RESULTCODES    ReturnCodes;
    APIRET         rc;

    cout << "Please input arguments here : " ;

    cin.get(Args, 10, '\n');
    cin.ignore(128,'\n');

    rc = DosExecPgm(LoadError,
        sizeof(LoadError),
        EXEC_SYNC,
        Args,
        Envs,
        &ReturnCodes,
        "hello.exe");

    if (rc == 0)
        {
        cout << "Termination Code " <<
ReturnCodes.codeTerminate
             << "\nReturn Code " << ReturnCodes.codeResult
             << endl;
        }

}

It *should* ask the user for input that it passes to the program
'hello.exe'.  Hello.Exe is a simple test program that will display any
arguments passed to it in the form;

Arg 1: blah
Arg 2: foo
[..]
Arg N: bar

What is *does* do is say that there is a NUL argument for 'Arg 1', it shows
whatever input the user passes as 'Arg 2' on ONE line, then it shows
garbage characters as 'Arg 3'.  I'm sure I have missed something obvious.

Yeah, I've tested 'hello.exe' on the command line, and that works fine.  I
am attempting to compile it using IBM CSet++ 2.1

Regards,


       Jason Meaden

--- FleetStreet 1.03.1 #18
* Origin: [+61 9 454 6970] -= Tiara Information Services =- (3:690/354)
SEEN-BY: 620/243 632/348 640/820 690/245 254 354 370 380 388 500 501 613 660
SEEN-BY: 690/686 711/409 410 413 430 807 808 809 934 949 955 712/515 713/888
SEEN-BY: 800/1 7877/2809
@PATH: 690/354 613 660 711/409 808 809 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™.