473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

C++ execute a UNIX command using Qt Designer?

Ok---I was wondering...Is there any way to make C++ execute a UNIX command using Qt Designer?

Like, I generate crypt command in my code.

Expand|Select|Wrap|Line Numbers
  1. void frmUtama::cryp()
  2. {
  3.     QString p = leSourceFile->text();
  4.     QString c = leFinalFile->text();    
  5.     execute("crypt -e -des p c ");
  6. }
  7.  
my code's not working, is there any way to do that
Jul 12 '07 #1
3 3603
archonmagnus
113 100+
Try the system() command. For your specific case, try:

Expand|Select|Wrap|Line Numbers
  1.  
  2. void frmUtama::cryp()
  3. {
  4.     QString p = leSourceFile->text();
  5.     QString c = leFinalFile->text();
  6.  
  7.     stringstream foo;
  8.     string bar;
  9.  
  10.     foo<<"crypt -e -des "<<p<<" "<<c;
  11.     getline(foo, bar);
  12.  
  13.     // interpretted as "crypt -e -des <sourceFile> <finalFile>"
  14.     system(bar.c_str());
  15. }
  16.  
Jul 12 '07 #2
Try the system() command. For your specific case, try:

Expand|Select|Wrap|Line Numbers
  1.  
  2. void frmUtama::cryp()
  3. {
  4.     QString p = leSourceFile->text();
  5.     QString c = leFinalFile->text();
  6.  
  7.     stringstream foo;
  8.     string bar;
  9.  
  10.     foo<<"crypt -e -des "<<p<<" "<<c;
  11.     getline(foo, bar);
  12.  
  13.     // interpretted as "crypt -e -des <sourceFile> <finalFile>"
  14.     system(bar.c_str());
  15. }
  16.  

Thanks, but I got stuck with the code when i run "make", this is the error message.
../frmutama.ui.h:42: error: ‘stringstream’ was not declared in this scope
../frmutama.ui.h:42: error: expected `;' before ‘foo’
../frmutama.ui.h:43: error: ‘string’ was not declared in this scope
../frmutama.ui.h:43: error: expected `;' before ‘bar’
../frmutama.ui.h:44: error: ‘foo’ was not declared in this scope
../frmutama.ui.h:45: error: ‘bar’ was not declared in this scope

how to solve that, i really don't know how to do
Jul 20 '07 #3
archonmagnus
113 100+
It sounds like you'll need to put the following with the rest of your preprocessor directives:
Expand|Select|Wrap|Line Numbers
  1. #include <sstream>   // for stringstreams
  2. #include <string>   // for strings
  3.  
Once you have those included, the code should work. (I think.) ;)
Jul 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Casanova | last post by:
Hello! How can I execute other exe files from within a executable file in GCC. In TurboC 3, the spawn command executes a file and returns command to the calling file. whereas in GCC, the exec...
6
by: Joseph | last post by:
Hi, I am trying to develop a C# application that will run on Windows that will do the following * Select file name to process * FTP the file to a UNIX server * Process this file on UNIX using a...
1
by: Mullin Yu | last post by:
But, I want is that I can have a Main app that will start a new process or kill one particular or all process. The process will open a console exe. But, I don't want the user to close the console...
14
by: technocrat | last post by:
db2 -t -v -f/home.../filename >output_file-name I have a java stored procedure..which has to run the above command...not sure how i can run this command through java.. any suggestions are...
7
by: spec | last post by:
Hi all, I know nothing about Python. What I need to do is to get a Python script to execute a local shell script. I do not need any output. What would be th eeasiest way to accomplish this? ...
9
by: sohan | last post by:
Hi, I want to know how to connect and execute a db2 query from inside a UNIX shell script. Details: We have a unix shell script. We need to execute multiple db2 sql queries from this shell...
7
by: sonet | last post by:
in perl we can execute command and get result(command line stdout) by $a=`cmdline parameter`; print $a; in c system('cmdline parameter'); but i can not get the result (command line stdout).
3
BenTheMan
by: BenTheMan | last post by:
Ok---I was wondering...Is there any way to make C++ execute a UNIX command? Like, I generate LaTeX files in my code, file.tex. Then I need to compile the .tex files with ``pdflatex file.tex''...
3
by: JB | last post by:
I'm writing a small utility and I need to be able to connect to a unix server and execute a couple of commands. How would I go about doing this? It's fairly simple from the command prompt using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.