On 2/12/2014 1:14 PM, Don Cavaiani wrote:
Buck, just saw you awesome step by step! The thing I cannot get a handle on is the 'size' or record layout/format of the .lgs PC file. No how I open/parse it, there seems to be no set format - but that it is just one Binary Large OBject?
RPG programmers like us are immersed in the world of unit record
equipment, whether we ever worked with punched cards or not. It's a
really useful way to model data, but it isn't the only one.
In the PC world, the stream file is king. The file doesn't have a
record length (card size) imposed on it from the outside; it contains a
stream of bytes that a program can interpret as needed. Our files are
modelled after punched cards. Stream files are modelled after main
memory (RAM).
This memory model is much more fluid than we RPGers are accustomed to.
You might think of a stream file as holding multiple, different sized
records in sequence, one after the other. So in the case of this
ratings file, you might have something like the first 2 bytes are the
binary number of teams in the list. The next bunch of bytes are the
first team's name. The name ends with x'00'. So it might be short
(JETS0, not 'JETS ') or long (WOLVERINES0). The next 2 bytes
might be how many games are ranked. The next bunch of bytes might be
the ranking: 2 bytes for each game listed in the rank header. And so on.
Basically, you read a header that explains what is coming next, and then
read 'detail' bytes. What 'detail' bytes might be could depend on a
count in the header, a length in the header, or an implied length (like
an array of 12 games).
Anyway, pretend you're an old C program and memory is scarce and
expensive - too expensive to waste even one single byte. Everything is
scrunched into the minimum amount of space as possible. Once you start
looking at the stream file like this, it'll start to make a little more
sense.
--buck
As an Amazon Associate we earn from qualifying purchases.