Flat File Reading

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

Hi,

I have a flat file with fixed length data all in continuous form with
two records shown below

01500 345202600 4939

output required in readable format with two records:

Record 1: 01500 3452
Record 2: 02600 4939

Im puzzled with ReadLine() function in VB.NET in splitting above line
into two records and then processing each one in turn.

I would appreciate any help in this matter.


Andrew
 
Hi Andrew,

How about something like this

Dim oStream As New IO.StreamReader("c:\myfilename.txt")

Dim strReadLine as string

While (oStream.Peek() > -1)
strReadLine = oStream.ReadLine()
Debug.Writeline("Record 1: " & Strings.left(strReadLine, 10)
Debug.Writeline("Record 1: " & Strings.right(strReadLine, 10)
End While

HTH
 
* (e-mail address removed) (Andrew) scripsit:
I have a flat file with fixed length data all in continuous form with
two records shown below

01500 345202600 4939

output required in readable format with two records:

Record 1: 01500 3452
Record 2: 02600 4939

Im puzzled with ReadLine() function in VB.NET in splitting above line
into two records and then processing each one in turn.

Instead of 'ReadLine', use 'Read' with the block length of a block.
 
Back
Top