[fpc-pascal] Endiannes & programmer's manual - missing compiler define?

Marco van de Voort marcov at stack.nl
Tue Jun 5 10:20:16 CEST 2012


In our previous episode, Reinier Olislagers said:
> 
> Also, I'm sure there must be functions to convert endianness - at least
> network byte order (big endian) to host order.
> I found e.g. Synapse synsock:
>   function ntohs(netshort: word): word;
>   function ntohl(netlong: longword): longword;
>   function htons(hostshort: word): word;
>   function htonl(hostlong: longword): longword;
> 
> Are there an equivalent RTL/FCL functions?

Yes, but don't use them.

There are independent endian routines in system.  Search for swapendian and
BEtoN, NtoBE etc.

Do not abuse network routines for non network usage.



More information about the fpc-pascal mailing list