spawnvp does not work

H

hpy_awad

I wrote that program but spawnvp dows not call the exe files hello1,hello2!!!

#include <stdio.h>
#include <conio.h>
#include <process.h>

//Tv Rental system menu version 1
int user_selection();
void display_menu();
void call_program(int option,char *argv[]);
int main(int ,char *argv[])
{
int option;
do
{
display_menu();
option=user_selection();
if (option!=7) //Exit
call_program(option,argv);
}
while (option!=7);
return 0;
}


void display_menu()
{
clrscr();
printf("1 hello1");
printf("\n2 hello2");
printf("\n3 exit");
}

int user_selection()
{
int opt;
printf("\n Enter required option(1-3) : ");
scanf("%1d",&opt);
return (opt);
}

void call_program(int opt,char *argv[])
{
void delay();
switch(opt)
{
case 1:
spawnvp(0,"hello1.exe",argv);
delay();
break;
case 2:
spawnvp(0,"hello2.exe",argv);
delay();
break;
default:
printf("\n incoreect input");
delay();
exit(0);
}
}
void delay()
{
int i;
for (i=0;i<20000;i++);
}
 
R

red floyd

I wrote that program but spawnvp dows not call the exe files hello1,hello2!!!
[redacted]

What is this spawnvp of which you speak? It's not in my copy of the standard.

Try a windows specific newsgroup.
 
H

Howard

Did you try debugging and see what is happenning? Is the value you expect
getting to the switch statement? Do you get any error messags? You asked
this before, and I made these comments (and others) then. It was also
suggested that you ask in a newsgroup that knows what the heck spawnvp is.
The suggestions still stand.

-Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,813
Members
47,357
Latest member
sitele8746

Latest Threads

Top