I want to execute the screenshot command "adb shell /system/bin/screencap -p /sdcard/img.png"
into C. I was searching for the same and I got a solution for another command and I modified the command as
execl("/system/bin/screencap", "-p", "storage/sdcard0/screenShot.png", (char *)NULL);
but when I run my application and call method of above command, application gets crash.
How should I modify the "/system/bin/screencap -p /sdcard/img.png
" command to run from C code.
Update after tom answer
Application is getting closed again and here is log
06-21 11:52:01.488: I/WindowState(279): WIN DEATH: Window{40fed2c0 u0 com.mytest.ndktestapplication/com.mytest.ndktestapplication.MainActivity}
06-21 11:52:01.498: I/ActivityManager(279): Process com.mytest.ndktestapplication (pid 7745) has died.
06-21 11:52:01.498: W/ActivityManager(279): Force removing ActivityRecord{40ea9ab8 u0 com.mytest.ndktestapplication/.MainActivity}: app died, no saved state