comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Binary file created with IDL strings
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Binary file created with IDL strings [message #57230] Wed, 05 December 2007 16:51
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 5, 5:59 pm, peajai.all.the....@gmail.com wrote:
>> Are you sure all the strings are 20 characters? Have you looked at
>> the file in a hex editor?- Hide quoted text -
>
>> - Show quoted text -
>
> I viewed the file in a hex editor and it appeared that I had the 20
> characters I was expecting but there was also 8 bytes of
> 00 00 00 14 00 00 00 14 after each string. So I skipped forward 616
> bytes and that worked! I am not sure what those extra 8 bytes are
> because nothing in the IDL code that was reading the file indicated
> there were any "extra" bytes.
>
> Thanks so much!
> PJ

Hmmm... 14 octal is FF?
Re: Binary file created with IDL strings [message #57239 is a reply to message #57230] Wed, 05 December 2007 15:59 Go to previous message
peajai.all.the.way is currently offline  peajai.all.the.way
Messages: 4
Registered: December 2007
Junior Member
> Are you sure all the strings are 20 characters? Have you looked at
> the file in a hex editor?- Hide quoted text -
>
> - Show quoted text -


I viewed the file in a hex editor and it appeared that I had the 20
characters I was expecting but there was also 8 bytes of
00 00 00 14 00 00 00 14 after each string. So I skipped forward 616
bytes and that worked! I am not sure what those extra 8 bytes are
because nothing in the IDL code that was reading the file indicated
there were any "extra" bytes.

Thanks so much!
PJ
Re: Binary file created with IDL strings [message #57272 is a reply to message #57239] Wed, 05 December 2007 13:46 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 5, 3:12 pm, peajai.all.the....@gmail.com wrote:
> On Dec 5, 12:12 pm, Vince Hradil <hrad...@yahoo.com> wrote:
>
>
>
>> On Dec 5, 11:00 am, peajai.all.the....@gmail.com wrote:
>
>>> On Dec 5, 11:36 am, Vince Hradil <hrad...@yahoo.com> wrote:
>
>>>> On Dec 5, 10:32 am, peajai.all.the....@gmail.com wrote:
>
>>>> > I am trying to read in a IDL created binary file in C++. The file
>>>> > contains floats, ints, doubles, and strings. I am able to read the
>>>> > floats and ints (shorts in C++) with no problem, but once I get to the
>>>> > section of the file containing strings, I cannot seem to read in the
>>>> > correct number of bytes. I am not concerned with the contents on the
>>>> > strings, but there is more data in floats after the strings that I
>>>> > need to be able to read properly. If possible, I could seek forward
>>>> > however many bytes just to get to the location of the data after the
>>>> > strings. Does anyone know how many bytes each character in an IDL
>>>> > string is? There are 22 strings, each 20 characters long. How many
>>>> > bytes would this be?
>
>>>> Each character is a byte.
>
>>> Do I need to account for an extra byte at the end of each string for a
>>> null terminator?
>
>> I should have guessed you were going to ask that 8) I avoided it
>> because I'm not 100% sure, but I think IDL does NOT write the null
>> terminator like C. Pretty easy to test...- Hide quoted text -
>
>> - Show quoted text -
>
> Easy in theory but not in practice, this problem has been vexing me
> for 2 days. I tried skipping forward 440 bytes (20char*22strings) and
> 462 bytes ((20char*22strings)+22nulls) and still did not end up in the
> right place in the file to correctly read the floats follow. The first
> string seemed to start 8 characters later than I expected it to, and I
> cannot tell if I need to add 8 extra characters for each string or if
> something is just weird at the beginning of strings. Mind you, I have
> IDL code that reads this same file perfectly so I know the file isn't
> bad and I am following the same order that the IDL code follows to
> read the data in.
>
> The IDL code actually just calls readu once and passes it all of the
> arrays it is expecting to populate and this includes one string array
> of 22 elements with 20 chars each. If this file was created in IDL and
> initialized with an array of strings, should there be extra bytes for
> the array? Or for each string? How would I be able to tell? Would an
> array of strings take up more bytes than just simply a set of
> contiguous strings?

Are you sure all the strings are 20 characters? Have you looked at
the file in a hex editor?
Re: Binary file created with IDL strings [message #57276 is a reply to message #57272] Wed, 05 December 2007 13:12 Go to previous message
peajai.all.the.way is currently offline  peajai.all.the.way
Messages: 4
Registered: December 2007
Junior Member
On Dec 5, 12:12 pm, Vince Hradil <hrad...@yahoo.com> wrote:
> On Dec 5, 11:00 am, peajai.all.the....@gmail.com wrote:
>
>
>
>
>
>> On Dec 5, 11:36 am, Vince Hradil <hrad...@yahoo.com> wrote:
>
>>> On Dec 5, 10:32 am, peajai.all.the....@gmail.com wrote:
>
>>>> I am trying to read in a IDL created binary file in C++. The file
>>>> contains floats, ints, doubles, and strings. I am able to read the
>>>> floats and ints (shorts in C++) with no problem, but once I get to the
>>>> section of the file containing strings, I cannot seem to read in the
>>>> correct number of bytes. I am not concerned with the contents on the
>>>> strings, but there is more data in floats after the strings that I
>>>> need to be able to read properly. If possible, I could seek forward
>>>> however many bytes just to get to the location of the data after the
>>>> strings. Does anyone know how many bytes each character in an IDL
>>>> string is? There are 22 strings, each 20 characters long. How many
>>>> bytes would this be?
>
>>> Each character is a byte.
>
>> Do I need to account for an extra byte at the end of each string for a
>> null terminator?
>
> I should have guessed you were going to ask that 8) I avoided it
> because I'm not 100% sure, but I think IDL does NOT write the null
> terminator like C. Pretty easy to test...- Hide quoted text -
>
> - Show quoted text -

Easy in theory but not in practice, this problem has been vexing me
for 2 days. I tried skipping forward 440 bytes (20char*22strings) and
462 bytes ((20char*22strings)+22nulls) and still did not end up in the
right place in the file to correctly read the floats follow. The first
string seemed to start 8 characters later than I expected it to, and I
cannot tell if I need to add 8 extra characters for each string or if
something is just weird at the beginning of strings. Mind you, I have
IDL code that reads this same file perfectly so I know the file isn't
bad and I am following the same order that the IDL code follows to
read the data in.

The IDL code actually just calls readu once and passes it all of the
arrays it is expecting to populate and this includes one string array
of 22 elements with 20 chars each. If this file was created in IDL and
initialized with an array of strings, should there be extra bytes for
the array? Or for each string? How would I be able to tell? Would an
array of strings take up more bytes than just simply a set of
contiguous strings?
Re: Binary file created with IDL strings [message #57319 is a reply to message #57276] Wed, 05 December 2007 09:12 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 5, 11:00 am, peajai.all.the....@gmail.com wrote:
> On Dec 5, 11:36 am, Vince Hradil <hrad...@yahoo.com> wrote:
>
>> On Dec 5, 10:32 am, peajai.all.the....@gmail.com wrote:
>
>>> I am trying to read in a IDL created binary file in C++. The file
>>> contains floats, ints, doubles, and strings. I am able to read the
>>> floats and ints (shorts in C++) with no problem, but once I get to the
>>> section of the file containing strings, I cannot seem to read in the
>>> correct number of bytes. I am not concerned with the contents on the
>>> strings, but there is more data in floats after the strings that I
>>> need to be able to read properly. If possible, I could seek forward
>>> however many bytes just to get to the location of the data after the
>>> strings. Does anyone know how many bytes each character in an IDL
>>> string is? There are 22 strings, each 20 characters long. How many
>>> bytes would this be?
>
>> Each character is a byte.
>
> Do I need to account for an extra byte at the end of each string for a
> null terminator?

I should have guessed you were going to ask that 8) I avoided it
because I'm not 100% sure, but I think IDL does NOT write the null
terminator like C. Pretty easy to test...
Re: Binary file created with IDL strings [message #57322 is a reply to message #57319] Wed, 05 December 2007 09:00 Go to previous message
peajai.all.the.way is currently offline  peajai.all.the.way
Messages: 4
Registered: December 2007
Junior Member
On Dec 5, 11:36 am, Vince Hradil <hrad...@yahoo.com> wrote:
> On Dec 5, 10:32 am, peajai.all.the....@gmail.com wrote:
>
>> I am trying to read in a IDL created binary file in C++. The file
>> contains floats, ints, doubles, and strings. I am able to read the
>> floats and ints (shorts in C++) with no problem, but once I get to the
>> section of the file containing strings, I cannot seem to read in the
>> correct number of bytes. I am not concerned with the contents on the
>> strings, but there is more data in floats after the strings that I
>> need to be able to read properly. If possible, I could seek forward
>> however many bytes just to get to the location of the data after the
>> strings. Does anyone know how many bytes each character in an IDL
>> string is? There are 22 strings, each 20 characters long. How many
>> bytes would this be?
>
> Each character is a byte.

Do I need to account for an extra byte at the end of each string for a
null terminator?
Re: Binary file created with IDL strings [message #57328 is a reply to message #57322] Wed, 05 December 2007 08:36 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 5, 10:32 am, peajai.all.the....@gmail.com wrote:
> I am trying to read in a IDL created binary file in C++. The file
> contains floats, ints, doubles, and strings. I am able to read the
> floats and ints (shorts in C++) with no problem, but once I get to the
> section of the file containing strings, I cannot seem to read in the
> correct number of bytes. I am not concerned with the contents on the
> strings, but there is more data in floats after the strings that I
> need to be able to read properly. If possible, I could seek forward
> however many bytes just to get to the location of the data after the
> strings. Does anyone know how many bytes each character in an IDL
> string is? There are 22 strings, each 20 characters long. How many
> bytes would this be?

Each character is a byte.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL 7.0/Eclipse DE memory hogger
Next Topic: Re: question about paths/workspace

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:02:18 PDT 2025

Total time taken to generate the page: 0.00504 seconds