Shifting Strings In Memory
Quote from Forum Archives on December 13, 1997, 7:13 pmPosted by: GBeckman <GBeckman@...>
Big news. Beckman does think about something besides volRefNum%!I am trying to gain file compatiblity between my Mac (FB) app and Windows
(Delphi).Both compilers allow a block save to disk and they are quick. I have some
string arrays. If I make my String Vars odd, then the Mac length byte makes
it even, no pad byte is needed and so the string/memory size is identical.Then we get to the fact that Mac puts the length byte at the the beginning and
Delph (PC) puts the length byte at the end of the string.On the onset I planned to parse and copy the string arrays. Then I thought:
Why couldn't I just allocate the entire block+1, move everything into the new
one, one byte to the right, paste on length the in the extra byte space, and
have it the whole array converted? (Some arrays are two dimentional)Trouble is, I am not sure I know how to do that. Anyone have something like
this?
Is it worth it? I have already loaded a block and done some parsing and it is
fairly fast.Thanks in advance,
George
Posted by: GBeckman <GBeckman@...>
I am trying to gain file compatiblity between my Mac (FB) app and Windows
(Delphi).
Both compilers allow a block save to disk and they are quick. I have some
string arrays. If I make my String Vars odd, then the Mac length byte makes
it even, no pad byte is needed and so the string/memory size is identical.
Then we get to the fact that Mac puts the length byte at the the beginning and
Delph (PC) puts the length byte at the end of the string.
On the onset I planned to parse and copy the string arrays. Then I thought:
Why couldn't I just allocate the entire block+1, move everything into the new
one, one byte to the right, paste on length the in the extra byte space, and
have it the whole array converted? (Some arrays are two dimentional)
Trouble is, I am not sure I know how to do that. Anyone have something like
this?
Is it worth it? I have already loaded a block and done some parsing and it is
fairly fast.
Thanks in advance,
George