Stew

read/write binary

1 post in this topic

Having trouble with binary read/write.  Writing a binary file for an integer using:

FileWrite($file,Number($intVal,1))

And then reading this data using:

$intVal = Number(FileRead($file,4),1)

Works perfectly.

Writing a binary file for a double using:

FileWrite($file,Number($doubleVal,3))

And then reading this data using:

$doubleVal = Number(FileRead($file,8),3)

Does not work.  Any ideas how to solve this problem?  I'm just trying to write a binary file mixed with strings, integers and floats and read the same file back in.  I can read/write strings and integers but not doubles.  The integers and strings read perfectly but the doubles all end up as "0".  The reading/writing is occurring on the same computer.  I have searched the forum but have been unsuccessful in finding a solution to the problem.

Thanks,

John

 

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now