[AMBER] still sscanf

From: Lixia Jin Day <ljin12.asu.edu>
Date: Wed, 27 Jan 2010 15:53:38 -0700

I posted a couple basic questions. Thanks for bearing me. There is no other
programmer in the lab.

I am studying NAB example program_11.nab now.
The first loop to read data from terminal (Standard input) is never end for
me. Even after I changed the MAXPTS to 5 (it was originally 150), it keeps
asking input. Here is the first part of the codes:


// Program 11 - Build DNA along a curve
#define RISE 3.38

#define EPS 1e-3
#define APPROX(a,b) (fabs((a)-(b))<=EPS)
#define MAXI 20

#define MAXPTS 5
int npts;
float a[ MAXPTS ];
float x[ MAXPTS ], y[ MAXPTS ], z[ MAXPTS ];
float x2[ MAXPTS ], y2[ MAXPTS ], z2[ MAXPTS ];
float tmp[ MAXPTS ];

string line;

int i, li, ni;
float dx, dy, dz;
float la, lx, ly, lz, na, nx, ny, nz;
float d, tfrac, frac;

int spline();
int splint();

for( npts = 0; line = getline( stdin ); ){
    npts = npts + 1;
    a[ npts ] = npts;
    sscanf( line, "%lf %lf %lf",
        x[ npts ], y[ npts ], z[ npts ] );
printf("npts=%d, line=%s\n", npts, line);
printf("x=%f y=%f z=%f\n",x[npts],y[npts],z[npts]);
}

..........
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Jan 27 2010 - 15:00:03 PST
Custom Search