Thanks to all that have replied, and salem, I *think* that I now have a better understanding of what's going on here. Forgive my coding methods, but it's a habit that I cannot break
What do you guys think of this? I'm still missing something here and I think it's the particular spawning member that I'm using. Spawnl is used when I know the exact number of arguments that are to be entered right? But what if the program doesn't know the exact arguements? Here is a really stripped down version of what I've got done.
Code:
// .h includes //
void spawnMe(char *, char *, char *);
int main()
{
int counter, ch;
char *buff1, *buff2, *buff3;
char fname[] = "applist.cfg";
ifstream inFile; // can't figure out how to use FILE *string :P
inFile.open(fname, ios::in);
if(inFile.fail())
{
blah
}
counter = 1;
while((ch = inFile.peek()) != EOF)
{
inFile >> buff1 >> buff2 >> buff3;
printf("\nTask [%d] press any key to launch %s ", counter, buff1);
getch();
spawnMe(buff1, buff2, buff3);
counter++;
}
printf("\nThe End.");
return 0;
}
void spawnMe(char *arg0, char *arg1, char *arg2)
{
int flag;
flag = spawnl(P_WAIT, arg0, arg0, arg1, arg2, NULL);
if(flag == -1)
// error message
}
The structure of the cfg file is
c:\pkware\pkzip.exe myzip.zip *.*
c:\pkware\pkunzip.exe -v myzip.zip
c:\windows\command\edit.com mytext.txt NULL
c:\windows\command\chkdsk.exe NULL NULL
How can I get rid of having to add NULL in the cfg file when I don't need the extra argument? I was rather stunned to see this work without hanging up at some point. Thanks for your help guys.