G
Guest
Thanks in advance for reading this.
Let's say I have a file (file01) with this data in ASCII (ignore line col):
line01 123abc
line02 Header01 Starts blah var
line03 detail01 000001
line04 detail02 000002
line05 detail03 000003
line06 detail04 000004
line07 detail05 000005
line08 detail06 000006
line09 detail07 000007
line10 Header01 Ends
line11 Header02 Starts blah var
line12 detail01 000001
line13 detail02 000002
line14 detail03 000003
line15 detail04 000004
line16 detail05 000005
line19 Header03 Ends
Here's what I need to do:
1. traverse each line and modify some section of the line
(it could postion 10-20) according to some logic in a function.
2. For Header line, I need to know the last detail line for that header
of a section (it could postion 20-25). So for Header02 (line11) I would
need to grab the value '000005' (line16).
The result for file01 will have it's line modified accordingly.
The main question is how can I traverse down line by line, and
when I get to the Header, somehow get the value of the last detail line
for that header, and continue the next line after the header which
is the first detail line.
I know you can do this in C by creating a dummy pointer to point
to the header and then traverse to the last detail line and return the
value. And then destroy the pointer.
I just don't know how to do this is .NET.
Thanks in advance for your replies!
Let's say I have a file (file01) with this data in ASCII (ignore line col):
line01 123abc
line02 Header01 Starts blah var
line03 detail01 000001
line04 detail02 000002
line05 detail03 000003
line06 detail04 000004
line07 detail05 000005
line08 detail06 000006
line09 detail07 000007
line10 Header01 Ends
line11 Header02 Starts blah var
line12 detail01 000001
line13 detail02 000002
line14 detail03 000003
line15 detail04 000004
line16 detail05 000005
line19 Header03 Ends
Here's what I need to do:
1. traverse each line and modify some section of the line
(it could postion 10-20) according to some logic in a function.
2. For Header line, I need to know the last detail line for that header
of a section (it could postion 20-25). So for Header02 (line11) I would
need to grab the value '000005' (line16).
The result for file01 will have it's line modified accordingly.
The main question is how can I traverse down line by line, and
when I get to the Header, somehow get the value of the last detail line
for that header, and continue the next line after the header which
is the first detail line.
I know you can do this in C by creating a dummy pointer to point
to the header and then traverse to the last detail line and return the
value. And then destroy the pointer.
I just don't know how to do this is .NET.
Thanks in advance for your replies!