Blankdraw wrote:
>
> [...] And teaching oneself a programming language is unlikely, for
> one thing, and not very rewarding for an able-bodied adult. [...]
"Unlikely?" Why? My own personal experience is exactly
the opposite: I've learned fifteen-plus programming languages
almost entirely through self-study. I've taken classes in
programming languages only twice, and neither was as successful
a means of learning as was studying the language on my own.
Different strokes for different folks, I guess. Anyhow ...
> Any chance I can get a little more help on one more idea?
> Is there a function, in ANSI/ISO basic C, that would "normally" be
> used to read a numerical data file (with numerous records of identical
> composition) record-by-record into a numerical buffer array (of size
> appropriate to 1 record of data), WITHOUT using a structure??? Seems
> like this would be a common need in programming, but maybe C requires
> use of structures or other advanced I/O techniques for this.
The approach I'd recommend would be to read lines of text
with fgets(), and then use functions like strtol() to extract
the numbers. The reason for doing it this way is that if
something goes wrong -- "1O" instead of "10" in the input,
for example -- you can do a much better job of detecting and
repairing or reporting the problem than you can with fscanf().
Or again: if a line somewhere in the middle of the file has
six numbers or four numbers instead of five, fscanf() won't
consider it an error but will simply get "out of step" with
the line breaks; line-at-a-time-and-pick-it-apart lets you
catch this problem as soon as it crops up.
I'm not sure why you bring up structures in this context.
You seem to want to process your numbers in batches of five,
and there doesn't seem to be a lot of "difference in kind"
between the numbers in each batch. The natural aggregate for
this would appear to be an array of five values, not a struct.
--