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?

1

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.

1
Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest