Re: why root GUI ?

From: Valery Fine (fine@bnl.gov)
Date: Tue Aug 18 1998 - 17:30:47 MEST


On 18 Aug 98 at 16:57, Wei Xie wrote:

> 
> You are definitly correct that we should manage pipes in a platform
> independent way. Can you give me a simple example on how to use 
> 
>       gSystem->OpenPipe() ?
> 
> I can not understand the discription in the manual very much.
> 
> Sincerely yours
> Xie
> 
> 

  Here you are an example from Microsoft Developer Studio Help file

    char   psBuffer[128];
    FILE   *chkdsk;
        /* Run DIR so that it writes its output to a pipe. Open this
         * pipe with read text attribute so that we can read it 
         * like a text file.     */
   if( (chkdsk = _popen( "dir *.c /on /p", "rt" )) == NULL )
      exit( 1 );
   /* Read pipe until end of file. End of file indicates that 
    * CHKDSK closed its standard out (probably meaning it 
    * terminated).
    */
   while( !feof( chkdsk ) )
   {
      if( fgets( psBuffer, 128, chkdsk ) != NULL )
         printf( psBuffer );
   }
   /* Close pipe and print return value of CHKDSK. */
   printf( "\nProcess returned %d\n", _pclose( chkdsk ) );}


   Replace

   _popen     with   gSystem::OpenPipe

   _pclose    with   gSystem::ClosePipe


  one will get the "platform independed" version.
  (I'd like to mention MS tries separate the real
   "STANDARD" function of the "de facto standard". 
   The last ones usually are supplied with the 
   leading "_" on its name. (or one may apply some special compilation
   option).

                           Valery
=================================================================
Dr. Valeri Faine (Fine)
    -------------------          Phone: +1 516 344 7806
Brookhaven National Laboratory   FAX  : +1 516 344 4206
Bldg. 510A /STAR                 mailto:fine@bnl.gov
Upton, New York, 11973-5000      http://nicewww.cern.ch/~fine
USA
                                 
Dr. Valery Fine                  Telex : 911621 dubna su
    -----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
Russia                           mailto:fine@main1.jinr.dubna.su                              



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:36 MET