Article View: borland.public.cppbuilder.nativeapi
Article #9472Big, Little and Bi endians
From: Donut
Date: Fri, 09 Jul 2004 09:18
Date: Fri, 09 Jul 2004 09:18
22 lines
1384 bytes
1384 bytes
Say we have data in the following sturcture to communicate;
typedef struct {
char A;
byte B;
int C;
long int D;
float E;
double F;
} MyDataStructure;
MyDataStructure MyData1;
Assume that we want to exchance data (send and receive) via ethernet (UDP,
TCP/IP) and serial (RS232) connections between different computers with
arbitrary combination of big,little or bi Endian.
Questions :
How to check in C++ program if our applciation running on a
Big/Little/Bi Endian machine?
Is there a generic way of transforming data (which could be in any
structure) between different endians?
Technical Details
Message-ID:
<40ee62ed$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e4fd0ef684fef580,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: <Donut> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Big, Little and Bi endians Date: Fri, 9 Jul 2004 19:18:38 +1000 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 211.30.68.31 Message-ID: <40ee62ed$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1089364717 211.30.68.31 (9 Jul 2004 02:18:37 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail