Hi,all
I want to use system() in android environment,but it seems cannot
work.
Here is my code(just a test):
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <error.h>
int main(void)
{
char *cmd = "/bin/ls -l" ;
int ret = -10 ;
ret = system(cmd);
printf("%s\n",cmd);
printf("the ret of system is %d\n",ret) ;
printf("error:%s\n",strerror(ret));
return 0 ;
}
After corss_compile,the result is:
# ./testSystem
/system/bin/ls -l
the ret of system is 32512
error:Unknown error 32512
But,# /system/bin/ls -l
-rwxrwxrwx root root 583452 2009-08-06 02:16 agentArm
-rwxrwxrwx root root 24297 2009-08-05 05:56 hello.ko
drwxrwxrwx root root 1980-01-06 00:23 test3GNetlink
-rwxrwxrwx root root 567932 2009-08-05 07:52 tyzTest
-rwxrwxrwx root root 583244 2009-07-29 07:07 agentTest
-rwxrwxrwx root root 564490 2009-08-06 06:48 testSystem
The ret of system is 32512,it means what?
How to make system work?
Any suggestions?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel
-~----------~----~----~----~------~----~------~--~---