Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | bilsch01 <king621@comcast.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | new question about data file |
| Date | 2015-06-08 03:25 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <ml3qfu$6mv$1@dont-email.me> (permalink) |
Taking into account the responses to my previous post (counting bytes)
to the extent that I understand those responses I need more information
to read my data file. I am reading with the same machine and OS that I
wrote the file with. This is how I wrote the data:
float w1,w2,w3,k1;
int xf,yf,xof,yof,xm,ym,delay,glength;
fprintf(fp,"%f%f%f%f%i%i%i%i%i%i%i%i",w1,w2,w3,k1,xf,yf,xof,yof,xm,ym,delay,glength);
Here is how I'm trying to read it back and print it:
fscanf(fp,"%f%f%f%f%i%i%i%i%i%i%i%i",&w1,&w2,&w3,&k1,&xf,&yf,&xof,&yof,&xm,&ym,&delay,&glength);
printf("%f %f %f %f %i %i %i %i %i %i %i
%i\n",w1,w2,w3,k1,xf,yf,xof,yof,xm,ym,delay,glength);
The floats read and print correctly but the ints are all wrong. Can
someone tell me the correct way to do the fscanf and printf statements
so I get back the data that I wrote?
TIA. Bill S.
Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread
new question about data file bilsch01 <king621@comcast.net> - 2015-06-08 03:25 -0700 Re: new question about data file James Kuyper <jameskuyper@verizon.net> - 2015-06-08 11:43 -0400
csiph-web