c语言控制手机,怎么写用电脑控制手机的代码

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

有个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;

}

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值