🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: free.it.visual-basic
Article #10

Re: Big Endian e Little Endian

#10
From: Nerone
Date: Sat, 18 Oct 2003 13:08
48 lines
2085 bytes
"Piero" <ghale@no_spam_libero.it> ha scritto nel messaggio
news:1A6kb.44952$vO5.1648143@twister1.libero.it...
> Ciao ragazzi,
> potete per cortesia aiutarmi nella conversione da Big Endian in Little
> Endian?
>
> Avrei bisogno di qualche suggerimento per scrivere un piccolo programma
> in Visual Basic che mi aiuti a convertire in un verso e nell'altro degli
> interi.
>
> Potete aiutarmi, per favore?

potresti ricorrere agli UDT:

Type tLittleEndian
    Byte0 As Byte
    Byte1 As Byte
    Byte2 As Byte
    Byte3 As Byte
End Type

Type tBigEndian
    Byte3 As Byte
    Byte2 As Byte
    Byte1 As Byte
    Byte0 As Byte
End Type

Private Type tLong
    x As Long
End Type

che puoi usare cosi':
Dim lE As tLittleEndian
Dim bE As tBigEndian
Dim xL As tLong

    xL.x = &H11223344

    LSet lE = xL
    LSet bE = xL
o
    LSet bE = lE

HTH

bye
r
Technical Details
Message-ID: <%Wakb.11512$e5.404523@news1.tin.it>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.infostrada.it!news-out.tin.it!news-in.tin.it!news1.tin.it.POSTED!not-for-mail
References: <1A6kb.44952$vO5.1648143@twister1.libero.it>

Show Full Headers
Complete Article Headers
X-Google-Language: ITALIAN,ASCII-7-bit
X-Google-Thread: f94ee,19012c8c7cdbf26a
X-Google-Attributes: gidf94ee,public
X-Google-Thread: 106fd2,19012c8c7cdbf26a
X-Google-Attributes: gid106fd2,public
X-Google-ArrivalTime: 2003-10-18 06:08:11 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.infostrada.it!news-out.tin.it!news-in.tin.it!news1.tin.it.POSTED!not-for-mail
From: "Nerone" <nerone@fakemail.org>
Newsgroups: free.it.visual-basic,free.it.programmazione.visualbasic
References: <1A6kb.44952$vO5.1648143@twister1.libero.it>
Subject: Re: Big Endian e Little Endian
Lines: 49
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <%Wakb.11512$e5.404523@news1.tin.it>
Date: Sat, 18 Oct 2003 13:08:11 GMT
NNTP-Posting-Host: 212.171.30.121
X-Complaints-To: newsmaster@tin.it
X-Trace: news1.tin.it 1066482491 212.171.30.121 (Sat, 18 Oct 2003 15:08:11 MET DST)
NNTP-Posting-Date: Sat, 18 Oct 2003 15:08:11 MET DST
Organization: TIN