g1smd - 9:57 am on Mar 5, 2011 (gmt 0)
There are likely fragments of code you can use already published somewhere.
I'd take a look at code.google.com and other such places. They could save you a lot of work.
I recently needed some code to read a CSV file and parse it into an array. I found what I needed within an hour, and had it working within a day.