RE: [ROOT] Problem using C (passing argu

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Mon Aug 06 2001 - 22:23:35 MEST


Hello Georges and Philippe,

Thank you for the bug report and sorry for long delay 
in response. I've been in 2 weeks business trip.

Following problem will be solved in next release. 

Thank you
Masaharu Goto


>Date: Thu, 26 Jul 2001 09:01:18 -0500
>From: Philippe Canal <pcanal@fnal.gov>
>To: Georges Lobo <lobo@irmm.jrc.be>, roottalk@pcroot.cern.ch
>Cc: Masaharu Goto <MXJ02154@nifty.ne.jp>
>Subject: RE: [ROOT] Problem using C (passing arguments)
>
>Hi,
>
>Did you try to run in CINT non-debug mode (i.e. do .O 0 before
>running your macro)?
>
>Philippe.
>
>-----Original Message-----
>From: owner-roottalk@pcroot.cern.ch
>[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Georges Lobo
>Sent: Thursday, July 26, 2001 2:17 AM
>To: roottalk@pcroot.cern.ch
>Subject: [ROOT] Problem using C (passing arguments)
>
>
>Hi Rooters,
>I'm trying to implement am existing C program which reads the neutron data
>files from ENDF. Since the file is quite complicated I want to use a
>program already written by somebody else. 
>I'm curently using it with CINT inside root.
>I had to do some adjustements but I am facing a problem which I don't
>understand. I give the pieces of the code where the problem occurs 
>/*Global variables */
>#define MIN(A,B)    ((A)<(B)) ? (A) : (B)
>char xfr_buf[128], *b66 = xfr_buf+ 66; /*global too */ 
>
>I'm doing then several call to the function endf_scan 
>written below. The calls are in a loop 
>
>endf_scan(xfr_buf,dv,MIN(rest,6));
>the local variables are defined as 
>double dv[2];
>long rest;     
>
>For the first step of the loop everything is OK, but in the second step 
>I have an error 
>Error: strncpy param[1]=0 must not be 0 
>Printing the value of b and v shows that for the second call all the
>arguments of endf_scan are null. I verified that the arguments before the
>call i.e. xfr_buf and dv are non-null. 
>I really don't understand what's happening. 
>Thanks in advance.
>
> /* ................................................. ENDF_SCAN
> * Scan an ENDF HEAD or TAB1  record b into d.fl.pt. vector v
> */
>int endf_scan(char *b, double *v, int lim)
>{
> 
>       int k, rv=0, mant;
>       char buf[14],*p;
>       buf[13]=EOS;
>       cout << "In endf_scan"<<endl;
>       printf("b adress = %i b content %s\n",&b,b);
>       //      printf("****\n%80s", b);
>       for ( k=0; k < lim; ++k, b += 11){
>               strncpy(buf, b, 11);
>               p = strpbrk(buf + 1, "+-");
>               if (p != NULL){
>                       mant = p - buf;
>                       strncpy(buf, b, mant);
>                       p[0] = 'E'; 
>                       p[1] =  b[mant];
>                       p[2] = (b[mant+1] == ' ')? b[mant+2] : b[mant+1];
>                       p[3] = ' ';
>               }
>               /*printf("%s\n", buf);*/
>               printf("print  before scanf );
>                       rv += sscanf (buf, "%lf", v + k);
>       }
>       /*******
>       for (k = 0; k < rv; ++k)
>               printf("%g\t", v[k]);
>       printf("\n");
>       if (rv == 6)
>               ags_exit ("STOP");
>       ********/
>       cout << "out endf_scan"<<endl;
>       return ( rv );
>}
>
>
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:56 MET