View Full Version : To pass a value as response to linux command using QT
chillin
28th February 2014, 06:48
Hi all,
I am designing an application using QT for an embedded device and I got stuck in an issue. I can able to pass the linux command using system() function. For a particular command I need to enter the password dynamically in the application window. Please help me to send the value for the previous executed command, dynamically using QT application.
Thanks in advance....
anda_skoa
28th February 2014, 11:29
I am not sure what you mean, but if you need more control over the external command, have a look at QProcess instead of system()
Cheers,
_
graciano
1st March 2014, 11:56
I think what chillin means is something like:
su -c "fdisk -l"
A command like this will ask for a password ...
chillin
2nd March 2014, 15:30
yes graciano you are correct.
I will explain the issue bit clearly.
I am developing an application in which I will run some commands using system() function, which may request password for commands with "sudo" and "ssh", in that case I need to pass the password as a string to response the command which will be waiting to get the password as input. I need help (with example code) to pass the password to the commands which are executed using the system() function.
anda_skoa
2nd March 2014, 16:34
Well, if you insist on using the system function, then you are out of luck.
Cheers,
_
Joelito
2nd March 2014, 16:40
I'm using linux and there's a reason about asking for a password...I read about echoing:
echo -e "tadaaa" | sudo -S format all
but, I prefer the asking annoy
chillin
3rd March 2014, 04:56
Please let me know (with scratch code) if any other function other than system() performs the same task.
Thank you in advance.
anda_skoa
3rd March 2014, 15:42
I suggest reading the replies then.
Comment #2 might be a good start.
Cheers,
_
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.