Hi,
stuck on sprintf again....
Code:#define BUFFER_SIZE 2048 void set_output_field(RecordOut * output, char * text, int field_number) { char buffer[BUFFER_SIZE]; <snip> case CIRCUIT_LENGTH: printf("CIRCUIT_LENGTH [%s]\n", text); printf("CIRCUIT_LENGTH [%f]\n", atof(text)); sprintf(buffer, "%019.3f", (int)(sizeof(output->circuit_length) - 1), atof(text)); printf("CIRCUIT_LENGTH [%s]\n", buffer); break;
/* OUTPUT */
CIRCUIT_LENGTH [16.72]
CIRCUIT_LENGTH [16.720000]
CIRCUIT_LENGTH [000000000000000.000]
the only undescribed item is circuit_length which is part of a structure
Code:#define O_CIRCUIT_LENGTH_LEN 19 typedef struct { char country [O_COUNTRY_LEN]; <snip> char circuit_length [O_CIRCUIT_LENGTH_LEN];
the quantity of characters output is fine, but I am blanking out the value somewhere,
tia,



LinkBack URL
About LinkBacks



