Data type u_int8_t , u_int16_t , u_int32_t on windows

On Linux the header file sys/types.h provides the fixed sized integer data types like these :

u_int8_t;
u_int16_t;
u_int32_t;

On windows the header file stdint.h provides similar ones but with slightly different names , uint8_t etc. So if you are writing cross platform code you can get the same ones on windows as in a manner shown below :

#if defined(_WIN32)

#include <stdint.h>

typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;

#endif

Now you can use u_int8_t , u_int16_t , u_int32_t on windows as well.







Last Updated On : 9th March 2012

Subscribe to get updates delivered to your inbox

Leave a comment