PDA

View Full Version : starting a linux-command from a program



Golly
July 13th, 2007, 06:34 PM
Hello,
I try to start APT from my program.
And compute the exit-code from this call in my program.

So I use
int erg = system("apt-get update");
When I start my program, the system-call running, but
the computer hangup after a view output-lines from APT.

What is wrong with my call?

Bye Golly

Wybiral
July 13th, 2007, 06:45 PM
Try:



int erg = system("sudo apt-get update");

Golly
July 14th, 2007, 08:41 AM
Try:



int erg = system("sudo apt-get update");


Hi, Wybiral,
that's OK. But what about the hanging computer?
The call for APT running but not so good.
Bye Golly

Mr. C.
July 14th, 2007, 10:46 PM
I don't believe your computer is hanging. Perhaps you mean that this process is waiting for input.

Since we don't know what you've done in your program (like closing STDIN), we can't diagnose the problem.

You'll have to give more details than what you've given.

MrC