>I need this code to be converted to VB. This procedure contains low level function used for opening a file and writing into it.
Check out
http://msdn.microsoft.com/scripting/ and click on VBSciprt, then Documentation, the FileSystemObject Tutorial, then "Working with FIles" on the right side.
That page is full of samples for doing lowlevel file stuff in VB.