Xref: utzoo comp.lang.c:30330 comp.sys.sgi:4885 Path: utzoo!attcan!uunet!nems!blackjack!hart From: hart@blackjack.dt.navy.mil (Michael Hart) Newsgroups: comp.lang.c,comp.sys.sgi Subject: Need help inputting Float #'s Message-ID: Date: 17 Jul 90 13:26:46 GMT Sender: news@nems.dt.navy.mil Followup-To: comp.lang.c Distribution: na Lines: 52 Yes, this is probably a stupid, obvious (RTFM) question to all you C geniuses, but, I have RTFM and the FM is not very explicit. What a surprise. I am trying to input a floating point number into my prog, in the format nnnnnn.mm . Using the following code, I see that it is reading the correct number of chars, but apparantly either is not storing them the way I want, or just not printing them out. Please respond via E-mail; that way I won't get too many flames for this question. BTW, #define SYSTEM SGI4D/25 #define OS 3.2.1 thanx code follows: ======================================= #include float *number; char *buffer[80]; int *c1; main() { printf("Please enter a number with a decimal point : "); gets(buffer); printf("\n"); sscanf(buffer,"%f%n",&number,&c1); printf("(debug: num of chars read was : %d)\n",c1); printf("\n"); printf("\n\n\nThe data as entered:\n"); printf("decimal number : %#6.2f\n",number); printf("\n"); } ======================================== -- ------------------------------------------------------------------------------- Michael G. Hart hart@blackjack.dt.navy.mil / mhart@dtrc.dt.navy.mil DTRC/DoD | "Wherever you go, there you are."- me DISCLAIMER: If you want the Navy's opinion, talk to Secretary Cheney. -- ------------------------------------------------------------------------------- Michael G. Hart hart@blackjack.dt.navy.mil / mhart@dtrc.dt.navy.mil DTRC/DoD | "Wherever you go, there you are."- me DISCLAIMER: If you want the Navy's opinion, talk to Secretary Cheney.