gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1617 Posts in 535 Topics by 779 Members - Latest Member: rhoronjeff@comcast.net November 27, 2022, 09:00:06 PM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  Windows  |  Byte swapped strings
gfx
gfxgfx
 

Author Topic: Byte swapped strings  (Read 5750 times)

mankoff

  • Newbie
  • *
  • Posts: 9
Byte swapped strings
« on: September 11, 2007, 03:08:22 PM »
Hi All,

I have a cross platform program that is reading in binary data. Works on OS X PPC and Intel (although Intel is through Rosetta AFAIK), but on Windows the strings are coming out byte swapped. "Hello" shows up as "llhe o" for example.

I took this project over from another developer and did not get a Makefile. Old versions of the binary work. I think this is a compiler flag issue. I've scanned the documentation but did not find anything that seemed relevant other than -N26 and -N27 which did not seem to change anything. Any hints greatly appreciated.

Thanks,

    Ken
« Last Edit: September 11, 2007, 03:39:03 PM by mankoff »

Mike Linacre

  • Sr. Member
  • ****
  • Posts: 259
Re: Byte swapped strings
« Reply #1 on: September 15, 2007, 07:25:44 PM »
When equivalencing data-types within Windows, the bytes do not always line up, so I use the RtlMoveMemory Windows API to swap the bytes around. It is also useful for moving non-standard numerical lengths, such as 3-byte integers into 4-byte integer fields, and vice-versa.

Absoft User Forum  |  Support  |  Windows  |  Byte swapped strings
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!