Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

endian.h on Windows [closed]

I'm working on a cross platform project on which I need endian.h. But this file is not on Windows or Mac OS X.

Is there any way I can get it to work without the file, or is there a way to get the file?

like image 284
lolzballs Avatar asked Sep 28 '12 22:09

lolzballs


1 Answers

I'm working on a cross platform project, which I need endian.h.

endian.h is not cross-platform. It is very clearly marked as such: "These functions are nonstandard."

You don't need endian.h. What you need is some of the functionality that that header provides. All three of Windows, Linux, and Mac (and Solaris, and others) do provide native to big endian functions, and they use the near-standard names htons, ntohl, etc. Will these suit your needs? If so, use them. They are portable. If not, you'll have to, well, roll your own. It's not hard. Or look to Boost. It probably has exactly what you want.

like image 138
David Hammen Avatar answered Oct 16 '22 06:10

David Hammen