[AMBER] fscanf

From: Lixia Jin Day <ljin12.asu.edu>
Date: Tue, 26 Jan 2010 14:34:37 -0700

Below is my testing code. When I compile it give me this warning:
nab -v testing.nab
cpp cmd: /usr/local/amber11/bin/ucpp -l -I/usr/local/amber11/include
testing.nab
nab2c cmd: /usr/local/amber11/bin/nab2c -nfname testing.nab
cc cmd: gcc -I/usr/local/amber11/include testing.c
/usr/local/amber11/lib/libnab.a /usr/local/amber11/lib/libsym.a
/usr/local/amber11/lib/carpack.a /usr/local/amber11/lib/clapack.a
/usr/local/amber11/lib/cblas.a /usr/local/amber11/lib/f2c.a -lm
testing.c: In function ‘main’:
testing.c:30: warning: format ‘%f’ expects type ‘float *’, but argument 3
has type ‘REAL_T *’
testing.c:30: warning: format ‘%f’ expects type ‘float *’, but argument 4
has type ‘REAL_T *’
testing.c:30: warning: format ‘%f’ expects type ‘float *’, but argument 5
has type ‘REAL_T *’


When I use sscanf(line, "%f %f %f",a[n].x, a[n].y, a[n].z); instead of
fscanf(pf,"%f %f %f",a[n].x, a[n].y, a[n].z); I get the same warning.
Ignoring the warning I ran the exe to find that all the output was 0.00000

Please advice where in the code is wrong. Thank you!

Lixia

//////////////////////code
//testing
string line;
point a[4];
int n;
file pf;


pf=fopen("data.txt","r");
line=getline(pf);
printf("%s\n",line);
for(n=0;n<4;n=n+1) {
fscanf(pf,"%f %f %f",a[n].x, a[n].y, a[n].z);
printf ("%f, %f, %f",a[n].x,a[n].y,a[n].z);
printf ("\tdone!\n");
}
fclose(pf);
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Tue Jan 26 2010 - 14:00:02 PST
Custom Search