Thans! I have tried /system/bin/ls ,it seems no work! And I review the $(ANDROID_DIR)/bioinc/libc/include/stdlib.h,I find the function system() is in the file. I have no idea how to do?
On 8月6日, 下午5时45分, Thomas Roth <[email protected]> wrote: > The return Value of 32512/256 is 127, so it seem like the command you were > trying to execute was not found or not properly executed. > I don't know if you have to execute /bin/ls oder /system/bin/ls, maybe this > is your problem. > Regards, > Thomas Roth > > > > On Thu, Aug 6, 2009 at 10:22 AM, 永振 田 <[email protected]> wrote: > > > 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! > > -- > I believe no one can invent an algorithm. One just happens to hit upon it > when God enlightens him. Or only God invents algorithms, we merely copy > them. > If you don't believe in God, just consider God as Nature if you won't deny > existence. -- Coywolf Qi Hunt --~--~---------~--~----~------------~-------~--~----~ unsubscribe: [email protected] website: http://groups.google.com/group/android-kernel -~----------~----~----~----~------~----~------~--~---
