简体   繁体   中英

inet_pton in QT creator for both windows and linux

i am writing a QT/C++ program, that i don't want to have dependecies on a specific OS (at least keep them to a minimum with some preprocessor directives).

i'm using QT Creator to design my program, which is done mainly on my Linux box, and every now and then, pull the code on the windows machine and attempt to compile it to make sure it still compiles.

to the point now, i need to use the functions inet_pton and inet_ntop, but they seem to be part of the GNU C Library. I looked around, and read that some MS libraries have them as well, though i'm no expert in MS development.

my question, is there an easy way to use these functions in my program? or am i better off checking out their code in glibc, and implementing them myself? or can you recommend some other alternative?

thanks in advance

inet_pton/etc is only available on Vista and above. If you need to run on WinXP you can use WSAStringToAddress().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM