[EMAIL PROTECTED] wrote:
> -------- Original-Nachricht --------
>> Datum: Mon, 21 Apr 2008 06:39:50 -0700
>> Von: Thomas Hruska <[EMAIL PROTECTED]>
>> Don't access the _value_, just copy the bytes.
>>
> 
> Well, sooner or later i have to access the _value_, cause thats what im 
> interested in. To recall my situation:
> im loading binary files, and, on loading, i swap the bytes, if needed 
> (determing that on header info). I load those files to get the values stored 
> in them of course:)
> Anyways, as i said, it all works fine here in practice , the only thing that 
> keeps me unsure is that people here say it doesnt work:)
> I suspect that, my method simply does not work "universal", as there would be 
> many systems/compilers wheter the used float method would funk it up. But, it 
> works fine on windows and macs , msvc and xcode. (which im fine with since my 
> code wont have to run elsewhere) Maybe?
> 
> Thanks once again
> Max

Your method probably works fine.  We were merely nitpicking (being 
"purists") and saying you shouldn't access the value _within_ the 
function.  Merely swap the bytes.  You can access the value later.


>> void ExtractSwappedFloat(float *MyFloat, char *Bytes)
>> {
>>    char *Buffer = (char *)MyFloat;
>>
>>    Buffer[0] = Bytes[3];
>>    Buffer[1] = Bytes[2];
>>    Buffer[2] = Bytes[1];
>>    Buffer[3] = Bytes[0];
>> }

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to