Re: WAV file question
>oh, well yeah, .wav file are in little endian and im doing that on a[color=blue]
>little-endian machine. so, if i compiled the same code on a Mac it
>couldn't read a .wav file properly?[/color]
Write your code properly to use Documented-endian (that is, the
endianness specified in the document describing the file format)
in the file, and write it so the Native-endian type does not matter.
This often involves shifting and masking. It almost certainly does
NOT involve using fread() to read binary data into a structure with
multi-byte integers as elements, then using it without further
adjustment. Oh, yes, you should also use the Documented integer
size in the file, and write your code so the type used in your code
is sufficient to hold that integer but won't break if the Native
integer size is bigger.
Gordon L. Burditt
>oh, well yeah, .wav file are in little endian and im doing that on a[color=blue]
>little-endian machine. so, if i compiled the same code on a Mac it
>couldn't read a .wav file properly?[/color]
Write your code properly to use Documented-endian (that is, the
endianness specified in the document describing the file format)
in the file, and write it so the Native-endian type does not matter.
This often involves shifting and masking. It almost certainly does
NOT involve using fread() to read binary data into a structure with
multi-byte integers as elements, then using it without further
adjustment. Oh, yes, you should also use the Documented integer
size in the file, and write your code so the type used in your code
is sufficient to hold that integer but won't break if the Native
integer size is bigger.
Gordon L. Burditt
Comment