should probably have said 'look at the binmode function' rather than 'use binmode' so as not to confuse with use'ing a module :(
-----Original Message----- From: Toby Stuart [mailto:[EMAIL PROTECTED] Sent: Monday, 15 August 2005 1:48 PM To: 'Daniel Kasak' Cc: 'beginners@perl.org' Subject: RE: Writing PNG data to a file use binmode my $png_data = get($http_request_string); open ( OUTPUT_HANDLE, "> $path/top_n.png" ); binmode OUTPUT_HANDLE; print OUTPUT_HANDLE $png_data; close OUTPUT_HANDLE; -----Original Message----- From: Daniel Kasak [mailto:[EMAIL PROTECTED] Sent: Monday, 15 August 2005 1:42 PM To: beginners@perl.org Subject: Writing PNG data to a file Hi all. I have some code that writes PNG data to a file, that works under Linux but not under Windows. The code: my $png_data = get($http_request_string); open ( OUTPUT_HANDLE, "> $path/top_n.png" ); print OUTPUT_HANDLE $png_data; close OUTPUT_HANDLE; Pretty simple, eh? A web server creates the graph ( legacy graphing system that works fine ), and returns it as a PNG file. Under Linux, I get a valid PNG file from the above, but under Windows, the file won't open. While trying to open it in various apps, one of them said that the file was corrupted by a conversion to ASCII. Should the above code work under Windows? How do I write binary data to a file so it works? -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>