"the above code doesnt do me any good.."
This is unconstructive. You don't go so far as to say what difference this made to your output. To avoid going around in circles with this problem (again) post a minmal example which recreates your problem, it doesn't have to be the entire program, just a short one which demonstrates the problem. Read and understand How do I post a question effectively?. Also you replied to yourself, not zentara.
Update: Also, please mark updates you make to posts to avoid confusion.