LinuxQuestions.org
Review your favorite Linux distribution.
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
 
Search this Thread
Old 02-04-2004, 09:52 AM   #1
seidren
Member
 
Registered: May 2003
Distribution: Ubuntu, Windows XP
Posts: 90

Rep: Reputation: 16
creating graphical front ends to commandline programs


Could anyone please explain to me, how are those graphical front ends such as k3b, grip, xcdroast etc work.

How do they get the information from the command line program (cdrecord etc..)

I searched the net and found articles on using tcl/tk to build frontends, but the programs I mentioned do not use tcl/tk. I would like to use C/C++ to make the frontends.

I would like to experiment with buildng gui frontends. Can anyone please shed some light.

Thanks,
Denesh.

Last edited by seidren; 02-04-2004 at 09:57 AM.
 
Old 02-04-2004, 10:11 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
They probably use system calls to execute the programs, capture there output, and parse it for updating there status fields in the gui. At least that is what I would do. But perhaps that is because I don't know a better way.

I am pretty sure programs like grip actually call the cdparanioa programs, and the encoder programs, and whatnot.
 
Old 02-05-2004, 07:39 AM   #3
seidren
Member
 
Registered: May 2003
Distribution: Ubuntu, Windows XP
Posts: 90

Original Poster
Rep: Reputation: 16
What you said is quite sensible... But what if the user has a different version of the backend software and the output of this is different from other versions... Do the frontend programs have to be able to parse all different backends??

Anyway how do you read the output of another program. Can anyone point me to a HOWTO or a sample program etc... I will be glad to try some examples.

Thanks.
 
Old 02-05-2004, 12:41 PM   #4
synna
Member
 
Registered: Jan 2004
Posts: 40

Rep: Reputation: 15
I think there are some classes in the boost (http://www.boost.org), I know that with wxWindows you can do it with a class like wxProcess. You can access an input stream and/or output stream of the process. If you don't want to use a library, I think you must use some pipe. If i'm correct, RealTimeBattle (it's a program) use it.

Last edited by synna; 02-05-2004 at 12:44 PM.
 
Old 02-05-2004, 12:50 PM   #5
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
There really isn't a good answer for the version stuff. Well, there is and there isn't. I think a program like grip assumes you have at least a certain version of a tool (and most likely checks for it when you run ./configure before building it). People try pretty hard to make new versions of software backwards compatible with old versions. Most good developers make sure to make lots of announcements before drastically changing anything, especially one something like an audio encoder.

As far as reading a programs output, you can redirect it's output to a buffer you are reading from.
 
Old 02-05-2004, 02:21 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
Wrapper UI's, like my own http://acidrip.sf.net work by doing what they need to do to get the results... sorry to sound dumb but there are oads of ways to access certain bits of information, generally it's though parsing the output of system calls and such....

you're asking about compatability etc... hell you're making the front end yourself, it is as compatible as you make it... there is no specification you have to conform to...

i'll tell you know though... generally C / C++ suck at text parsing, they're not desgined for it. you might want to look at a scripting language instead... perl or python for example.
 
  


Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking Programs to the commandline BorgKiller Linux - Software 2 04-05-2005 09:10 PM
ReKall, PgAccess ... Any Other DB Front Ends? rickh Linux - Software 2 03-04-2005 03:33 PM
MRTG front ends tmakobu Linux - Networking 1 02-04-2005 09:15 AM
Is there any graphical front end for Squid? geraldomanaus Linux - Newbie 1 02-06-2003 01:45 PM
Graphical front end to iptables or ipchains redgore Linux - Security 5 04-23-2002 07:26 PM


All times are GMT -5. The time now is 08:23 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