Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3327

Re: Binary file: SAT

From 7stud -- <bbxx789_05ss@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: Binary file: SAT
Date 2011-04-21 12:53 -0500
Organization Service de news de lacave.net
Message-ID <00a061658a9946c7c43c68a0fe83f318@ruby-forum.com> (permalink)
References <f82185e10f19c74e1962c03aeccd4771@ruby-forum.com>

Show all headers | View raw


Suppose your file contains this data:

"\x00\x00\x00\x01"

Scenario 1:
The four bytes could represent the number of widgets sold (=1).

Scenario 2:
Or the first two bytes could represent the number of widgets sold(=0), 
the third bytes is the number of widgets in inventory(=0), and the 
fourth byte is the number of widgets in transit to the factory(=1).

So unless you know what each byte in the file is supposed to represent, 
you cannot read the file correctly.  If someone hands you the file with 
the above data in it, and says, "Here's your data.  Get cracking!", and 
the person walks out the door, how would you know if Scenario 1 or 
Scenario 2 is the way the data is laid out?

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Binary file: SAT Alessandro Barracco <bomastudio@gmail.com> - 2011-04-20 17:00 -0500
  Re: Binary file: SAT 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-20 19:02 -0500
    Re: Binary file: SAT 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-20 19:45 -0500
      Re: Binary file: SAT Roger Braun <roger@rogerbraun.net> - 2011-04-20 21:53 -0500
        Re: Binary file: SAT Alessandro Barracco <bomastudio@gmail.com> - 2011-04-21 03:06 -0500
          Re: Binary file: SAT 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-21 12:25 -0500
            Re: Binary file: SAT Alessandro Barracco <bomastudio@gmail.com> - 2011-04-22 04:51 -0500
              Re: Binary file: SAT 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-22 13:49 -0500
                Re: Binary file: SAT William Rutiser <wruyahoo05@comcast.net> - 2011-04-23 13:20 -0500
  Re: Binary file: SAT 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-21 12:53 -0500

csiph-web