RE: stupid question



thanks a lot for ur answer

i thought doing it long time ago
thus i need high perfomance
and i would prefer to avoid using hard drive access
if it is possible :D
i also thought about storing it in env variable (   system("tmp_var=`grep
Page MyDoc|wc -l`") and then use
myvar=atoi(getenv(tmp_var)); to access command result
but i guess there should be a more simple solution and more effective
anyway thanks for ur answer amigo :)

any other suggestion ??

-----Message d'origine-----
De : "Seisdedos Nuñez, Monserrat" [mailto:mseisdedos cirsa com]
Envoyé : mercredi 18 septembre 2002 09:55
À : 'CAVEY GERARD'; 'gtk-list gnome org'
Objet : 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
> 


*************************************************************************
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. 

*************************************************************************






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