K
Kristian Frost
Silly title, sorry.
Anyway, I'm thoroughly confused about the whole new "streams" business and
it's very late in my local day, so I wondered if any of you in other parts
of the world could solve this one for me while I go home and sleep.
My problem is that I want to read some whole lines from some legacy saved
text-based datafiles and then read individual comma-separated values from
the lines into an ObjectRecogniser object I have mostly-working.
So the data-line:
foo, bar, helloworld, 1
will be recognised by my ObjectRecogniser as an object of type 1 with data
"foo", "bar" and "helloworld", which it does fine as far as that goes, but
it can't process the data until it sees that 1, and I can't guarantee that
the 1 will be the data identifier without seeing the linebreak. The lines
are, of course, all of many varying lengths.
The filereader for our legacy LoadFile function uses heavily structured,
complex and highly breakable code to read the exact data it is expecting
at exactly the right point in the file with hundreds and hundreds of
individual "Input #File, data" commands. It puts appropriate linebreaks in
during the save process so the data is fairly human-readable, but the
loading process is reading in Strings and not giving any indication as to
what the separators used were.
We're trying to move to a more versatile, expandable system which will
recognise objects from their savelines and act accordingly, so I can't use
their legacy code system as it fails to "see" the difference between a
comma and a linebreak.
Can anyone tell me how I could read the file a line at a time and feed the
line to some new function that would read the comme-separated values?
I'm thinking that these "stream" things are the way to go, but they're all
very much a mystery to me at this point.
Even some basic advice would be welcome.
Cheers,
KF
Anyway, I'm thoroughly confused about the whole new "streams" business and
it's very late in my local day, so I wondered if any of you in other parts
of the world could solve this one for me while I go home and sleep.
My problem is that I want to read some whole lines from some legacy saved
text-based datafiles and then read individual comma-separated values from
the lines into an ObjectRecogniser object I have mostly-working.
So the data-line:
foo, bar, helloworld, 1
will be recognised by my ObjectRecogniser as an object of type 1 with data
"foo", "bar" and "helloworld", which it does fine as far as that goes, but
it can't process the data until it sees that 1, and I can't guarantee that
the 1 will be the data identifier without seeing the linebreak. The lines
are, of course, all of many varying lengths.
The filereader for our legacy LoadFile function uses heavily structured,
complex and highly breakable code to read the exact data it is expecting
at exactly the right point in the file with hundreds and hundreds of
individual "Input #File, data" commands. It puts appropriate linebreaks in
during the save process so the data is fairly human-readable, but the
loading process is reading in Strings and not giving any indication as to
what the separators used were.
We're trying to move to a more versatile, expandable system which will
recognise objects from their savelines and act accordingly, so I can't use
their legacy code system as it fails to "see" the difference between a
comma and a linebreak.
Can anyone tell me how I could read the file a line at a time and feed the
line to some new function that would read the comme-separated values?
I'm thinking that these "stream" things are the way to go, but they're all
very much a mystery to me at this point.
Even some basic advice would be welcome.
Cheers,
KF