LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 06-01-2010, 09:17 PM   #1
supravat
LQ Newbie
 
Registered: Jun 2009
Posts: 21

Rep: Reputation: 15
Help in GTK+ programming


I have created a executable file using c and I have also created a GUI using GTK+. Now how can I call the executable file from the GUI with arguments passing to the executable file.

Can any one please help me.....
 
Old 06-01-2010, 09:23 PM   #2
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,469

Rep: Reputation: 64
How did you create the GUI because there are two ways to do this in GTK+.
 
Old 06-01-2010, 09:50 PM   #3
supravat
LQ Newbie
 
Registered: Jun 2009
Posts: 21

Original Poster
Rep: Reputation: 15
Arrow

I have created the GUI using normal c programming.... That's the only way I know.. Is there any other option ???
 
Old 06-01-2010, 10:03 PM   #4
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,469

Rep: Reputation: 64
Hmmm strange. Why not just incorporate the c program into the GUI program? I suppose you could just use a system call but that would not be advisable.
 
Old 06-01-2010, 10:53 PM   #5
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 806

Rep: Reputation: 161Reputation: 161
Quote:
Originally Posted by exvor View Post
Why not just incorporate the c program into the GUI program?
That would indeed be the way to do it, with the following wrinkle:
Quote:
Originally Posted by exvor View Post
I suppose you could just use a system call but that would not be advisable.
A call to system() might be just the thing to do. If you sometimes or often use that other program stand-alone, without using GTK+, it would be helpful from a maintenance point of view to keep the two programs (the one using GTK+ and the one it wants to run) separate. That way, if you want to make an improvement in the called program, you can make the change in only one place and it will be made for both the stand-alone operation and the GTK+ program.

If the stand-alone program produces output (a little or a lot), you have a couple of options.
  1. Don't really use system(); instead, use fork(), exec(), and waitpid(), and use pipes to read the output.
  2. In a system() call, direct the output to a file, just as you would if you were at a shell prompt:
    Code:
    if(system("fred_program > fred_output.txt"))
    {
      /* do error recovery here */
    }
 
  


Reply

Tags
gtk+, help, programming


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GTK Programming Help bkd Programming 3 10-16-2006 05:15 PM
GTK programming geminigal Programming 1 06-02-2005 03:08 AM
GTK programming geminigal Programming 11 04-06-2005 04:30 AM
Programming with GTK dfownz Programming 6 07-17-2004 01:50 PM
GTK and programming NSKL Programming 2 01-14-2003 03:30 PM


All times are GMT -5. The time now is 11:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration