TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: RICKEY PARRISH
from: ANTHONY TIBBS
date: 1998-03-22 16:51:00
subject: help with a front-end

Hello Rickey.
21 Mar 98 00:18, Rickey Parrish wrote to All:
 RP> char *runit;                    // not sure if char *runit is right :)
 RP> runit="mpg123";                 // program i wanna run is mpg123
 RP> runit=runit + "-m -z /stuff/mp3s/example.mp3";
 RP>                                 // i'll add a few questions, and these
 RP>                                 // are just example run-time arguments
 RP>                                 // that i might use.  so i wanna run
Well, this won't work.  You are probably looking for something like:
#include 
#include 
#include 
int main (int argc, char **argv)
{
int cArg;
char Program_Command [120];
    strcpy (Program_Command, "myprog");
    /* ^= Program_Command = "myprog" */
    cArg = argc;            /* argc = number of arguments */
                            /* argv = arguments themselves */
    while (cArg < argc)
    {
        strcat (Program_Command, " ");
        strcat (Program_Command, argv [cArg]);
        /* ^= Program_Command = Program_Command + " " + argv[cArg] */
        cArg++;
    }
    printf ("Executing: %s\n", Program_Command);
    system (Program_Command);
    return 0;
}
 RP> input, but i dont have a help file (yet), so i dont know how to
 RP> use case blah
 RP>         do this
 RP> case blah2
 RP>         do this instead
 RP> end case
 RP> or even if that is used in C.  im just switching from quickbasic right
 RP> now :)
Actually, in C, you use something like:
#include 
int main (void)             /* We don't really need argc/argv. */
{
int Number;
int Result;
    /* Read a single digit from the user. */
    Result = scanf ("%d", &Number);
    /* Make sure we really got a number. */
    if (Result != 1)
    {
        printf ("You didn't enter a number!\n");
        return 1;
    }
    /* Test this number. */
    switch (Number)
    {
        case 1:     printf ("The number is one!\n"); break;
        case 100:   printf ("The number is one hundred!\n"); break;
        case 913:   printf ("The is nine thirteen!\n"); break;
        default :   /* We get here if nothing else matched. */
                    printf ("You entered some weird number, like %d\n",
                                                                    Number);
    }
    return 0;
}
Anthony
---
---------------
* Origin: The Tibbs' Point - Ottawa, ON, Canada - Pvt (1:163/215.38)

SOURCE: echomail via exec-pc

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™.