Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create BINARY output file

Status
Not open for further replies.

cosports

Programmer
Joined
Dec 16, 2000
Messages
9
Location
US
Please help.
I am trying to create a Binary output file. The file i create with my sub spits out 0's and 1's that can be read in a text editor. I need a Binary file that looks like garbage when you open with a text editor, but dont know enough to ask the right question. Here is the code i'm using:

sub getFloat2Bin {
my ($floatVal) = @_;
my $binaryFloat = unpack("b32", pack("f", $floatVal));
return $binaryFloat;

}

this gives a nice string of 0's and 1's but I am looking for binary output.... any suggestions? deadline is fast approaching.

thanks eric
 
Can't you just remove the unpack part and output the packed number?
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
thanks tracy,
I had it that way originally, but it didnt seem to work. guess something else was wrong that got fixed along the way. thanks tons
eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top