C++: The BYTE Class?

Started by
15 comments, last by laserbeak43 16 years, 1 month ago
It probably needs to be:
fread(&size,sizeof(DWORD),1,fp);
Advertisement
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 Konfusius
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'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.
I usually try to make all my code(not much) portable. I`m Studying cross platform GUI programming with QT4.
__________________________________________________________Maybe one day i can not be affraid of venturing out of the beginners section.
Quote:Original post by jyk
Quote:Original post by Konfusius
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'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.


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 :)
__________________________________________________________Maybe one day i can not be affraid of venturing out of the beginners section.
the whole thing ended up being wrong for what i was doing. i've tried all kinds of tutorials from MCI to libsndfile. i'll be 1000 years old before i can read a wave file. actually trying to get an 11 line program using MCI to work now. Pssh!!
__________________________________________________________Maybe one day i can not be affraid of venturing out of the beginners section.

This topic is closed to new replies.

Advertisement