Simple question. What would an equally functioning conversion look like in C#?
VB6:
Dim rec As String * 200
If rs!cJobNum <> "" Then
Open PathFintest & Mid(rs!cJobNum, 2, 5) & ".dat" For Random As #1 Len = 200
s = Val(Mid(rs!cJobNum, 7, 4))
Get #1, Val(Mid(rs!cJobNum, 7, 4)) + 1, rec
Close #1
TestRec = rec
Fail = FindFailure(TestRec)
End If
This was my attempt in C# (doesn't return similar results):
FileStream tempFile = File.OpenRead(tempPath);
var tempBuf = new byte[200];
var tempOffset = Int32.Parse(StringHelper.Mid(rs.Fields["cJobnum"].Value, 7, 4)) + 1;
tempFile.Seek(tempOffset , SeekOrigin.Begin);
tempFile.Read(tempBuf, 0, 200);
rec.Value = new string(System.Text.Encoding.Default.GetChars(tempBuf));
tempFile.Close();
TestRec = rec.Value;
Fail = (string)FindFailure(ref TestRec);