[Gambas-user] htonl equal
Les Hardy
les at ...2337...
Mon Apr 12 17:35:53 CEST 2010
You can use htonl/ntohl from external libs.
A very quick example below. Please correct me if I got it wrong.
' Gambas module file
PUBLIC EXTERN htonl(ln AS Long) AS Long IN "libc:6"
PUBLIC EXTERN ntohl(ln AS Long) AS Long IN "libc:6"
PUBLIC SUB Main()
DIM ln, lh AS Integer
ln = 1193046
PRINT "Input: " & ln
PRINT "Input (hex): " & Hex(ln, 8)
lh = htonl(ln) ' to BigEndian
PRINT "BigEndian: " & lh
PRINT "BigEndian (hex): " & Hex$(lh, 8)
ln = ntohl(lh) ' back to LittleEndian
PRINT "LittleEndian: " & ln
PRINT "LittleEndian (hex): " & Hex$(ln, 8)
END
Regards
Les Hardy
Mohammad Razeghi wrote:
> Hi
>
> I am looking for c++ htonl function equal in gambas can any one help please
> ?
>
> Thanks ...
>
More information about the User
mailing list