该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
有个adb命令,://在屏幕上点击坐标点x=50 y=250的位置。
adb shell input tap 50 250,它可以模拟点击手机屏幕,我以为可以借助它用键盘控制手机,我想写个能检测键盘输入,并执行相应命令的软件,但出现了错误:
e.c: 在函数‘main’中:
e.c:9:12: 警告:隐式声明函数‘kbhit’ [-Wimplicit-function-declaration]
if(kbhit()){
^~~~~
e.c:10:13: 警告:implicit declaration of function ‘getch’; did you mean ‘getc’? [-Wimplicit-function-declaration]
ch=getch();
^~~~~
getc
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccXyR6sk.o: in function `main':
e.c:(.text+0x10): undefined reference to `kbhit'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: e.c:(.text+0x1e): undefined reference to `getch'
collect2: 错误:ld 返回 1
函数似乎运行错误,又可以代替的吗
以下是代码:
#include
#include
#include
int main(void)
{
char ch;
while(ch!=27)
{
if(kbhit()){
ch=getch();
switch(ch){
case 'w':execl("/usr/bin/adb","shell","input",
"tap","1367","474",NULL);break;
}
}
}
printf("End!\n");
return 0;
}