On Wed, 2006-01-18 at 12:35 +0500, Shamaila Khalid wrote: > hi > > i m a student and i want to play a mp3 file at a button click ... Hi, This isn't the right place to be asking these questions. This list is about GTK+. > i m not understanding how to use the following code .. > as i m working in glade . If you want to connect a button click, then I suggested you look at the gtk-demo that comes with the download of gtk+. > plz help > > > #include<unistd.h> > > gchar *gs_call[3]; > > > >rc = fork (); > > if (rc == -1) { > > g_warning ("Can?t fork ()"); > > } else if (rc == 0) { > > gs_call[0] = "mpg123"; > > gs_call[1] = song_name; > > gs_call[2] = 0; > > execvp (gs_call[0], gs_call); > > } > You can use the man or info pages to understand this (or perhaps even google). But to spare you the time, this is a quick run down of what it does. The 'fork' function: fork creates a child process that differs from the parent process only in its PID and PPID, and in the fact that resource utilizations are set to 0. File locks and pending signals are not inherited. The 'execvp' function: The exec family of functions replaces the current process image with a new process image. The functions described in this manual page are front-ends for the function execve(2). (See the manual page for execve for detailed information about the replacement of the current process.) The execv and execvp functions provide an array of pointers to null-terminated strings that represent the argument list available to the new program. The first argument, by convention, should point to the file name associated with the file being executed. The array of pointers must be terminated by a NULL pointer. So, in short, what happens is, you application creates a child process and then from that child process, you execute another process (which happens to be the mpg123 application (which will play mp3s). Next time, make use of the man pages (with 'man execvp' or 'man fork') to find out the information above before writing to a list about something off topic. If you still have questions about how to hook this up to a button with GTK+, I or anyone here would be happy to help. -- Regards, Martyn _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list