Re: [gtk-list] fork() with gtk ?



On Tue, 13 Jul 1999 09:09:09 +0000, Vanotti bertrand wrote:
> Hello, i'm a new developper with gtk and i wish to use 
> something like fork() and execl for printing a document. Is 
> a function exist with gtk to do this ? In fact, i realize a 
> software which draw plots on a the screen and i want to 
> print them. If nothing exist with gtk, someone could give 
> me an example of execl using. My print command is "lpr 
> -Phpljps" but how use this.

There is no standard fork() wrapper in GTK+. If you want to use fork(), a
copy of "Advanced programming in the Unix environment" by Richard Stevens
might be helpful. If you don't care about the fact that your application
is not responsive during the printing, try using system() instead:

  /* print command. make this configurable, because my system uses
   * "lp -dlp5" ...
   */
  char print_cmd[] = "lpr -Phpljps";
  char buf[256];

  /* construct print command */
  g_snprintf(buf, 256, "%s %s", print_cmd, file_to_print);

  /* do it */
  system(buf);


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]