Re: Opening binary data from MSVS under linux
- To: firstname.lastname@example.org
- Subject: Re: Opening binary data from MSVS under linux
- From: Micha <email@example.com>
- Date: Tue, 12 Feb 2008 18:55:59 +0200
- Message-id: <firstname.lastname@example.org>
- In-reply-to: <email@example.com>
- References: <firstname.lastname@example.org> <20080211164510.GC7089@titan.hooton> <20080211170536.GJ8028@pear.tzafrir.org.il> <email@example.com>
On Tue, 12 Feb 2008 12:53:44 +0200
Micha <firstname.lastname@example.org> wrote:
> On Mon, 11 Feb 2008 17:05:36 +0000
> Tzafrir Cohen <email@example.com> wrote:
> > On Mon, Feb 11, 2008 at 11:45:10AM -0500, Douglas A. Tutty wrote:
> > > On Mon, Feb 11, 2008 at 06:05:08PM +0200, Micha wrote:
> > > > I have a stream of unsigned long numbers saved from visual studio (2005)
> > > > that I'm trying to open under linux, but the format seems to be very
> > > > strange (doesn't seem to be neither big endian nor little endian). For
> > > > example, the set of numbers 2, 288, 2624, 490 (or in hex 0x2 0x120,
> > > > 0xA40, 0x1EA) comes out (in hex)
> > > Your first 0x2 should be 0x002 to keep padding correct.
> > >
> > > > 02 00 00 00 20 01 00 00 40 0D 0A 00 00 EA 01 00
> > > ^
> > > where did the D come from?
> That was what I was wondering about, but found the solution, appearing later
> > > >
> > > > Any idea what the format is and how to read it?
> > >
> > > I don't have a hex calculator handy (and I don't have time at the moment
> > > to do it by hand). Please verify the decimal to hex converion.
> I verified it several times and even rewrote the same data from linux and got
> what you and I were expecting.
> > Psst...
> > printf "%04X\n" 2 288 2624 490
> > 0002
> > 0120
> > 0A40
> > 01EA
> I am aware of that, if that's what I have seen I would have had no issues,
> had I?
BTW, I just re-read the mail and it seems that it might come over a bit
offensive. No such intent was made, just less than 5 hours a night for a couple
of nights ... sorry if any offence was taken.
> You are assuming that I am directly stupid and not just indirectly stupid ;-)
> Anyway, I found the problem. The binary data was written by mistake in text
> mode under windows instead of binary mode. That's why msvs opened it
> correctly but matlab and linux (and the hex editor) messed it up.
> This brings me to the next question. Is there a way to open a text file
> (containing binary data) from windows under linux correctly (will dos2unix do
> the work for binary data or does it only convert carriage returns?
> > But don't tell anybody