I want to set the file pointer again after storing a determined position.
Sample:
If strReturnvalue = "Start Section" And Not blnSectionstarted Then
intOffset = sr.BaseStream.Position
blnSectionstarted = True
xtw.WriteStartElement("CompSection")
End If
If strReturnvalue = "End Section" And blnSectionstarted Then
blnSectionstarted = False
xtw.WriteEndElement()
End If
If (intPrevious = -1 And intRecord <> -1) Or (intPrevious <> -1 And intRecord <> -1 And intRecordPointer <> 11) Then
If blnSectionstarted Then
xtw.WriteElementString("ComponentLine", strPrevious)
Else
xtw.WriteElementString("Tekst", strPrevious)
End If
strPrevious = strRule
Else
strPrevious = strPrevious & strRule
End If
intPrevious = intRecord
End If
Loop
sr.BaseStream.Seek(intOffset, SeekOrigin.Begin)
intOffset = sr.BaseStream.Position
strCurrent = sr.ReadLine
The intOffset stores the position which is later used in the basestream.seek method. The position is set, however the strCurrent = sr.Readline retrieves a string as if the sr.basestream.seek has never been done.
Please help me out to shift back in position reading a simple text file.
Thanks.
Sample:
If strReturnvalue = "Start Section" And Not blnSectionstarted Then
intOffset = sr.BaseStream.Position
blnSectionstarted = True
xtw.WriteStartElement("CompSection")
End If
If strReturnvalue = "End Section" And blnSectionstarted Then
blnSectionstarted = False
xtw.WriteEndElement()
End If
If (intPrevious = -1 And intRecord <> -1) Or (intPrevious <> -1 And intRecord <> -1 And intRecordPointer <> 11) Then
If blnSectionstarted Then
xtw.WriteElementString("ComponentLine", strPrevious)
Else
xtw.WriteElementString("Tekst", strPrevious)
End If
strPrevious = strRule
Else
strPrevious = strPrevious & strRule
End If
intPrevious = intRecord
End If
Loop
sr.BaseStream.Seek(intOffset, SeekOrigin.Begin)
intOffset = sr.BaseStream.Position
strCurrent = sr.ReadLine
The intOffset stores the position which is later used in the basestream.seek method. The position is set, however the strCurrent = sr.Readline retrieves a string as if the sr.basestream.seek has never been done.
Please help me out to shift back in position reading a simple text file.
Thanks.