I'm am working on a project that requires me to make adb shell commands. The code below is just a test program so that I can understand how to pass adb shell commands from C++. When I run this code I get the following error: sh: adb: command not found. I have the android sdk tools and platform tools in my path and I can run adb shell from my terminal.
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
system("adb devices");
return 0;
}
Thanks to Jiang YD I was able to solve it. I just called adb from it's absolute path and it worked.