In reply to Somasekhar M:
The easy way to do this is to read the data as a single string. Then declare a queue and push a byte at a time as you convert each ASCII element to binary.
The performance of this should be OK but if not, you can do this with a DPI-C routine.