🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1558

Re: c programming question

#1558
From: Doug Gwyn
Date: Sun, 05 Aug 1990 01:17
26 lines
1867 bytes
In article <Aug.4.14.20.02.1990.4835@elbereth.rutgers.edu> shmehta@elbereth.rutgers.edu (Shreefal Mehta) writes:
>i hope this is the right newsgp to post to; i went by the title as
>there was no news to be read in the newsgp. i guess either this means
>that no one writes to this gp in which case no one reads either, or
>that my machine does not receive the newsgp..

I don't know what it means at your site, but this newsgroup is intended
for discussions about the C standard.  General discussion and questions
about C should be posted to comp.lang.c (INFO-C Internet mailing list),
which is where I have directed follow-ups.

>Any way, my question is simple. i want to read in three Floating POint
>numbs. i can either read them in from a file or i can type them in. i
>foundout that i can't do 'getchar.' So how can i read in the data to
>three variables. 

If they are stored in character format, as I suspect from the mention
of typing them in, use scanf() or fscanf() to read them and convert them
into internal floating-point representation.

If they were stored in binary format corresponding to their internal C
floating-point representations, you could use fread() to "roll them into"
internal floating-point variables of the same size.

Any good introductory C programming book should explain this.  Kernighan
& Ritchie's "The C Programming Language" is recommended.
Technical Details
Message-ID: <13476@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!gwyn
References: <Aug.4.14.20.02.1990.4835@elbereth.rutgers.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: c programming question
Keywords: reading in floating point characters
Message-ID: <13476@smoke.BRL.MIL>
Date: 5 Aug 90 01:17:59 GMT
References: <Aug.4.14.20.02.1990.4835@elbereth.rutgers.edu>
Followup-To: comp.lang.c
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 26