Jump to content
  • Advertisement
Sign in to follow this  
lordcorm

htons()

This topic is 3751 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any c/c++ library that has htons() that isnt platform dependent?, i dont want to include windows.h, and im not a big fan of the: #ifdef WIN32 // Windows Headers Here #elif LINUX // Linux Headers Here #elif MAC // Mac Headers Here #else // Go Die! #endif Thanks, Lordcorm

Share this post


Link to post
Share on other sites
Advertisement
Sorry, but a few #ifdefs are necessary in life. Or perhaps more accurately, you don't go adding a whole new library to get around doing it for htons. You will find it for a few other common functions available across Linux and Windows - that's just the way it is.

If, however, your question is, "can I find a cross-platform networking library?", then the answer is "yes, of course - check the Forum FAQ for the Multiplayer/Networking forum".

Share this post


Link to post
Share on other sites
You can always write your own. htons() and friends just swap the endianess of multi byte variables (right?)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!