GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Execute another program on a button click

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
forward83



Joined: 09 Mar 2008
Posts: 2

PostPosted: Sun Mar 09, 2008 11:14 pm    Post subject: Execute another program on a button click Reply with quote

Hi

I'm new to GTK+ and is trying to execute another when a button is clicked. Using Linux(new to me too :oops: ). Can it be done using C and how?

Code: (C)
1
2
3
4
5
6
7
8
void on_button1_clicked (GtkButton *button,
gpointer user_data)

{

//What code should be here to run another application?
//system() ?
}

Thanks.
Back to top
Zarg
Familiar Face


Joined: 09 Mar 2008
Posts: 10

PostPosted: Sun Mar 09, 2008 11:39 pm    Post subject: Reply with quote

Hello!

This should work:

Code: (Plaintext)
1
2
3
4
5
6
7
8

void on_button1_clicked (GtkButton *button,
gpointer user_data)
{
    /* Execute firefox */
    system ("firefox&");
}


You can also execute programs depending on gpointer user_data.

Have fun,
Zarg
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP