简体   繁体   中英

Qt execute external executable program?

I am writing a Qt program to connect with Android devices.

I know that I should execute the adb first, and the connection is based on TCP , so I need to run

./adb forward tcp:xxport tcp:xxport

How to run this line in Qt ? I have copy the adb to my project file.

I develop this on Linux , and would run on Windows XP , so prefer cross-platform plan (only works on Windows XP is fine also).

QProcess p;
p.start(adbBinaryPath(), {"forward", "tcp:xxport", "tcp:xxport"});

To run adb you can use QProcess. Note that you need compiled adb binary for each windows and linux platforms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM