- Original Message -
From: "M Pulis"
To: "FPC-Pascal users discussions"
Sent: Monday, October 26, 2009 9:27 AM
Subject: Re: [fpc-pascal] WORD (2 bytes) to String conversion
On Oct 25, 2009, at 3:09 PM, Paul Nicholls wrote:
- Original Message - From
On Oct 25, 2009, at 3:09 PM, Paul Nicholls wrote:
- Original Message - From: "Graeme Geldenhuys" >
To: "FPC-Pascal users discussions"
Sent: Friday, October 23, 2009 11:10 PM
Subject: [fpc-pascal] WORD (2 bytes) to String conversion
Hi,
I'm reading in a
- Original Message -
From: "Graeme Geldenhuys"
To: "FPC-Pascal users discussions"
Sent: Friday, October 23, 2009 11:10 PM
Subject: [fpc-pascal] WORD (2 bytes) to String conversion
Hi,
I'm reading in a WORD (2 bytes) from a binary file. I can display the
In our previous episode, J??rgen Hestermann said:
> > As Marco suggested... Char size might not always be the same.
>
> Why that? I hope noone changes the meaning of such long-time types some
> day. If a new type is needed, then it should get a new name too.
Codegear did this with Delphi 2009 i
As Marco suggested... Char size might not always be the same.
Why that? I hope noone changes the meaning of such long-time types some
day. If a new type is needed, then it should get a new name too.
___
fpc-pascal maillist - fpc-pascal@lists.freep
Graeme Geldenhuys schreef:
2009/10/24 Vincent Snijders :
But then you still cannot do:
if header.id='HS' then
// magic is correct.
That is why I proposed a static array of char.
No, but I can do this... which is sufficient.
var
s: string
begin
s := hdr^.ID;
if S = "HS" then
...
2009/10/24 Vincent Snijders :
>
> But then you still cannot do:
>
> if header.id='HS' then
> // magic is correct.
>
> That is why I proposed a static array of char.
No, but I can do this... which is sufficient.
var
s: string
begin
s := hdr^.ID;
if S = "HS" then
...
--
Regards,
-
Graeme Geldenhuys schreef:
On 23/10/2009, Vincent Snijders wrote:
You can consider declaring the ID in the header record type as array[1..2]
of char.
As Marco suggested... Char size might not always be the same. I did
however change my header to array[0..1] of byte instead.
But then you
On 23/10/2009, Marco van de Voort wrote:
> >
> > You can consider declaring the ID in the header record type as
> > array[1..2] of char.
>
> (starting to use ansichar might not be bad)
Good point. But I preferred to go with array of Byte.
--
Regards,
- Graeme -
_
On 23/10/2009, Vincent Snijders wrote:
>
> You can consider declaring the ID in the header record type as array[1..2]
> of char.
As Marco suggested... Char size might not always be the same. I did
however change my header to array[0..1] of byte instead.
--
Regards,
- Graeme -
___
In our previous episode, Vincent Snijders said:
> > various bits of information, without the need for a hex editor etc...
> > So the solution described earlier will suffice for my needs.
> >
> >
>
> You can consider declaring the ID in the header record type as
> array[1..2] of char.
(starting
Graeme Geldenhuys schreef:
On 23/10/2009, Jürgen Hestermann wrote:
Wouldn't it be more direct to use
Blockwrite(,header.ID,sizeof(header.ID));
I read the complete header structure in one go (155 bytes). I simply
want to output to a text file, a human readable structure of the
complete INF f
On 23/10/2009, Jürgen Hestermann wrote:
>
> Wouldn't it be more direct to use
> Blockwrite(,header.ID,sizeof(header.ID));
I read the complete header structure in one go (155 bytes). I simply
want to output to a text file, a human readable structure of the
complete INF file. The INF file format
I would like my program to output the following:
-
Header Section
header.ID(5348h = "HS")
...
-
Wouldn't it be more direct to use
Blockwrite(,header.ID,sizeof(header.ID));
That would make it robust against changes of ID size and would avoid the
many typ
On 23/10/2009, Jeff Wormsley wrote:
> Oh, I was fairly certain of that. Its just these little routines tend to
> end up in libraries of handy code. I tend to be overly cautious with some
> of these because of that.
Point taken. :-) This code is purposely rewritten and totally
standalone so I
Graeme Geldenhuys wrote:
On 23/10/2009, Jeff Wormsley wrote:
That's dangerous, though, if your magic number's two bytes aren't printable
That should never be a problem for my tool though. The tool I am
writing is specific to the INF help format. The tool dumps the fil
On 23/10/2009, Jeff Wormsley wrote:
>
> That's dangerous, though, if your magic number's two bytes aren't printable
That should never be a problem for my tool though. The tool I am
writing is specific to the INF help format. The tool dumps the file
structure to a text file. (I need this for debu
Graeme Geldenhuys wrote:
Hi,
I'm reading in a WORD (2 bytes) from a binary file. I can display the
Hex format of that value without a problem, but I would also like to
display the String value of that WORD variable. It's the first 2 bytes
of a file, which contains the "magic number" of the file
2009/10/23 Aleksa Todorovic :
>
> w: WORD
> ...
> YourString := Chr(Lo(w)) + Chr(Hi(w))
> or
> YourString := Chr(Hi(w)) + Chr(Lo(w))
Ah, thanks. I was close, I used High() and Low() instead. :-( Dope!
--
Regards,
- Graeme -
___
fpGUI - a cross-p
On Fri, Oct 23, 2009 at 14:10, Graeme Geldenhuys
wrote:
> Hi,
>
> I'm reading in a WORD (2 bytes) from a binary file. I can display the
> Hex format of that value without a problem, but I would also like to
> display the String value of that WORD variable. It's the first 2 bytes
> of a file, which
Hi,
I'm reading in a WORD (2 bytes) from a binary file. I can display the
Hex format of that value without a problem, but I would also like to
display the String value of that WORD variable. It's the first 2 bytes
of a file, which contains the "magic number" of the file.
I would like my program t
21 matches
Mail list logo