About this blog

Hi folks, Jamie here.

I'm a web developer at the PaddyPower.com.
I blog about web development, content management systems, design, user experience and anything else that comes to mind.

Feeds

Problem with creating a new file in Ruby on WinXp

I came across this problem today. I was attempting to create a new binary file using Ruby and tried the following:

File.new(”picture.jpg”, “w”)

While this worked on the *nix os, it resulted in a corrupt binary file when run in WINXP.

Solution

To create a binary file in ruby you will need to include the “wb” option. See below.

File.new(”picture.jpg”, “wb”)

Bye!

Leave a Reply