fread(&size,sizeof(DWORD),1,fp);
C++: The BYTE Class?
Quote:Original post by jyk
Also, if you're interested in writing portable code, a good first step would be replace BYTE and DWORD with their C/C++ equivalents, char (probably unsigned) and... Well, there isn't a built-in primitive type in C++ (at this time) that's guaranteed to be 32 bits wide, but you can use the typedefs (uint32 or whatever) provided in newer versions of the C standard (?) or in the Boost libraries.
Yargh.
Portable win32 code? Portable to what, Linux?
Quote:Original post by KonfusiusI'm not following. I might be missing something, but other than the aforementioned typedefs, I didn't see any indication that the OP intends to write Win32-only code.Quote:Original post by jyk
Also, if you're interested in writing portable code, a good first step would be replace BYTE and DWORD with their C/C++ equivalents, char (probably unsigned) and... Well, there isn't a built-in primitive type in C++ (at this time) that's guaranteed to be 32 bits wide, but you can use the typedefs (uint32 or whatever) provided in newer versions of the C standard (?) or in the Boost libraries.
Yargh.
Portable win32 code? Portable to what, Linux?
I usually try to make all my code(not much) portable. I`m Studying cross platform GUI programming with QT4.
Quote:Original post by jykQuote:Original post by KonfusiusI'm not following. I might be missing something, but other than the aforementioned typedefs, I didn't see any indication that the OP intends to write Win32-only code.Quote:Original post by jyk
Also, if you're interested in writing portable code, a good first step would be replace BYTE and DWORD with their C/C++ equivalents, char (probably unsigned) and... Well, there isn't a built-in primitive type in C++ (at this time) that's guaranteed to be 32 bits wide, but you can use the typedefs (uint32 or whatever) provided in newer versions of the C standard (?) or in the Boost libraries.
Yargh.
Portable win32 code? Portable to what, Linux?
Yes, sorry. I'm a little tired. I thinkg that the typedefs (BYTE and DWORD etc) are there exactly for portability reason. Using undisguised C++ types like unsigned char seems a step backwards to me.
Quote:Original post by jyk
It probably needs to be:fread(&size,sizeof(DWORD),1,fp);
that works :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement