B
Bernard Liang
(Using GCC) Simplified excerpt:
typedef struct {
double a;
double b;
double c;
} my_type;
int read(FILE* fp, my_type* data) {
char src_buffer[1024];
char q[16];
float utc_time;
...
sscanf(src_buffer, "%12s %f %f %f %f\n", q, &utc_time, &(data->a),
&(data->b), &(data->c));
}
Suppose that src_buffer looks like " 13:39:55.871 204234.000000
3746.741211 -12223.571289 20.279785\n".
For some reason, it is stuffing 0.0's into data->a, data->b, and
data->c. Why is that? I can't seem to figure out why this can possibly
be happening. Is there a problem with my implementation of what I am
trying to do? The alternative is to make other temporary floats and then
to assign them to data->a ... (which works), but this shouldn't be
necessary.
-Bernard Liang
typedef struct {
double a;
double b;
double c;
} my_type;
int read(FILE* fp, my_type* data) {
char src_buffer[1024];
char q[16];
float utc_time;
...
sscanf(src_buffer, "%12s %f %f %f %f\n", q, &utc_time, &(data->a),
&(data->b), &(data->c));
}
Suppose that src_buffer looks like " 13:39:55.871 204234.000000
3746.741211 -12223.571289 20.279785\n".
For some reason, it is stuffing 0.0's into data->a, data->b, and
data->c. Why is that? I can't seem to figure out why this can possibly
be happening. Is there a problem with my implementation of what I am
trying to do? The alternative is to make other temporary floats and then
to assign them to data->a ... (which works), but this shouldn't be
necessary.
-Bernard Liang