I am making single frontend program that will convert mp3 to ogg files and vice versa. First this is my important function:

Code:
int spawn( char* program, char** arg_list ) {
	pid_t child_pid;

	child_pid = fork();
	if( child_pid != 0 ) 
		return child_pid;
	else {
		execvp( program, arg_list );
	}
}
Basically because this is front end, I use system call function in my program. Here's how my Linux box convert mp3 files to ogg files if done in bash shell.

mpg321 inputfiles.mp3 -w inputfiles.wav ( takes about 10+ seconds )
oggenc inputfiles.wav ( takes about 30+ seconds )
rm inputfiles.wav ( takes about 1- seconds )


Here's my program :
Code:
.....
switch(type) {
		case mp3: arg_list[0] = "mpg321";
			  song.copy( arg_list[1], songlength, 0 );
			  arg_list[1][songlength] = '\0';
			  arg_list[2] = "-w";
			  outputsong.copy( arg_list[3], outputsonglength, 0 );
			  arg_list[3][outputsonglength] = '\0';
			  arg_list[4] = NULL;
			  spawn("mpg321", arg_list);
			  wait(&childstatus);
			  arg_list[0] = "oggenc";
			  outputsong.copy( arg_list[1], outputsonglength, 0 );
			  arg_list[1][outputsonglength] = '\0';
			  arg_list[2] = NULL;
			  spawn("oggenc", arg_list);
			  wait(&childstatus);
			  arg_list[0] = "rm";
			  outputsong.copy( arg_list[1], outputsonglength, 0 );
			  spawn("rm", arg_list);
			  wait(&childstatus);
			  break;
..........
The problem with this approach, in converting process ( if I push convert button ), I cann't manipulate my application's window. I cann't push any button. I cann't do anything with my window. After the process is done, the window become normally again. I can remove wait(&children) statement but it will execute rm inputfiles.wav before it finish convert mp3 files to wav files ( remember mpg321 inputfiles.mp3 -w inputfiles.wav takes about 10+ seconds ). Without wait(&children) statement, my program will execute all the statements above in less than 1 second.

To make it short, I have 3 commands to execute and I want it done in order. So command number 2 will wait command number 1 finish its processing. But in their processing, I want to manipulate my application's window.

Any idea, guyz?????