PDA

View Full Version : [SOLVED] Build GUI and execute command line



sid.mallya
February 26th, 2011, 02:46 PM
I am a complete newbie at Linux Development and have no idea how to go about this.

I am using Festival for TTS and using the text2wave function to create an audio file for a given text file.

What language can I use to build the GUI ? and how do I execute command line statements in it.

I am sorry if these questions are beyond dumb. :popcorn:

hakermania
February 26th, 2011, 04:03 PM
You can use anything you want.
I would suggest Qt Creator (C++).
As for command line executions see the system() function or the QProcess

sid.mallya
February 26th, 2011, 09:13 PM
Thanks for the quick reply ! Okay .. So I got system() working in C++. Can I pass arguments in system tho ? I mean, say I want the name of the input and output files; can I pass them in the system statement ?

cgroza
February 26th, 2011, 11:19 PM
Yes, just build you command line string and then convert it to a C string and execute the system().

sid.mallya
February 27th, 2011, 03:52 PM
char command[100];
strcpy (command, "text2wave ");
strcat (command, ui->lineEdit->text());
strcat (command, " -o ");
strcat (command, ui->lineEdit_2->text());
if (system(NULL)) {

system(command);


Hey when I use this, I get the error


/home/siddharth/TTS/TactileReader/mainwindow.cpp:34: error: cannot convert ‘QString’ to ‘const char*’ for argument ‘2’ to ‘char* strcat(char*, const char*)’

What should I do ?

sid.mallya
February 27th, 2011, 04:03 PM
Nevermind. I got it

hakermania
February 27th, 2011, 06:06 PM
It is better to post your solutions here too :) For anyone following this topic, a google search will definitely help. It helped me at least when searching my own issues with qt ;P

sid.mallya
February 27th, 2011, 06:14 PM
The QString of QT Creative is native to it and hence does NOT work in the same manner as const char * <name>

The way to convert QString to char string is simply this, (in my example)

const char * command = ui->lineEdit->text().toLocal8Bit().constData();

Done !

juancarlospaco
February 28th, 2011, 02:32 AM
if you dont want to code using a programing language, you can use Zenity and 9Menu...