Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
System.BitConverter on Big-Endian-Platforms
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.compactframework.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Stefan Mecke
Hi all!

Could anyone please verify and post the behavior with MS.NET compact
framework on a big-endian system? The docs I found are not precise about
whether BitConverter always returns the platforms native endianness or
always little-endian like x86.

Thanks
Stefan Mecke

--------------------------------------------------------
using System;

public class Test
{
public static void Main(string[] args)
{
if (!BitConverter.IsLittleEndian){
byte[] ba;
int i4 = 45555;

ba = BitConverter.GetBytes(i4);

for (int i=0; i<ba.Length; i++)
{
Console.Write(" {0:x}", ba[i]);
}
Console.WriteLine();
} else {
Console.WriteLine("Little-endian-platform -- doesn't help");
}
}
}
Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Chris Tacke, eMVP (VIP)
CE only runs on little-endian devices.....

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net

"Stefan Mecke" <Click here to reveal e-mail address> wrote in message
news:c2su38$20q0l1$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Steven
If you have need to read data produced by a big-endian system (such as a Palm database file), you might do as I did under the same circumstances. I read the data into bytes arrays one field/value at a time and manually reversed the bytes in the array. I then passed the reversed bytes into bitconverter. I have had no trouble reading Palm databases this way for quite a while.
Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Chris Tacke, eMVP (VIP)
Ah! Can't see the forest for the trees, sorry.

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net

"Steven" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> If you have need to read data produced by a big-endian system (such as a
Palm database file), you might do as I did under the same circumstances. I
read the data into bytes arrays one field/value at a time and manually
reversed the bytes in the array. I then passed the reversed bytes into
bitconverter. I have had no trouble reading Palm databases this way for
quite a while.

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Jamie Macleod
That's what i do as well.

"Steven" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> If you have need to read data produced by a big-endian system (such as a
Palm database file), you might do as I did under the same circumstances. I
read the data into bytes arrays one field/value at a time and manually
reversed the bytes in the array. I then passed the reversed bytes into
bitconverter. I have had no trouble reading Palm databases this way for
quite a while.

Reply to this message...
Vote that this is a GOOD answer...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
 
System.BitConverter
System.Console




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734