RE: stupid question



You can use the popen system call:
FILE *shell_fd;
char cabecera[80];

shell_fd = popen ("grep Page MyDoc|wc -l", "r");

  if ((shell_fd == (FILE *) NULL) || (shell_fd == (FILE *) - 1))
    return;

  while (fgets (cabecera, 80, shell_fd) != NULL)
    {
       printf("%s\n",cabecera);

    }
> -----Mensaje original-----
> De: gtk-list-admin gnome org 
> [mailto:gtk-list-admin gnome org]En nombre
> de CAVEY GERARD
> Enviado el: miércoles 18 de septiembre de 2002 9:54
> Para: gtk-list gnome org
> Asunto: stupid question
> 
> 
> Hi,
> this question is not gtk specific thus...
> check that piece of code:
> 
> //i use the following to count the number of page in my doc
> //thus how can i get the output of that command and store it 
> in a variable?
> 
> system("grep Page MyDoc|wc -l")
> 
> 
> hope someone can help :D
> 
> Greetings
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> 
> **************************************************************
> ***********
> Ce message et toutes les pieces jointes (ci-apres le "message") sont
> confidentiels et etablis a l'intention exclusive de ses destinataires.
> Toute utilisation ou diffusion non autorisee est interdite. 
> Tout message electronique est susceptible d'alteration. 
> SG Asset Management et ses filiales declinent toute 
> responsabilite au titre
> de ce message s'il a ete altere, deforme ou falsifie.
> 
> Découvrez l'offre et les services de SG Asset Management sur le site
> www.sgam.fr 
> 
> 				********
> 
> This message and any attachments (the "message") are confidential and
> intended solely for the addressees.
> Any unauthorised use or dissemination is prohibited. 
> E-mails are susceptible to alteration.   
> Neither SG Asset Management nor any of its subsidiaries or 
> affiliates shall
> be liable for the message if altered, changed or falsified. 
> 
> **************************************************************
> ***********
> 
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 



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