S
SteMc
today I tackled, for the first time, opening and reading from a text
file.
Following the example on the MSDN and declared a variable, strline as a
string and objstreamreader as a streamreader.
Basically I read in a line of a text file - this works fine.
I then read in another line. This works fine
However, the third time round I read character by character, until I
get to to the 40th character on the line, because this is the position
of some information that is a variable that I need. The problem is that
when using the read command (strline = objstreamreader.read) each
character is being given as a number (for example, when a space is read
in the string shows the number "32"). When I get to the correct
character I should get the string "1", instead I'm getting something
else. (A different number, but it's definately a translation of 1, not
the wrong character because all other characters on the line are
letters from a to z).
does anyone know why this happens and how I can re-translate the
number/code back into an alphanumeric version?
thanks,
Steve
file.
Following the example on the MSDN and declared a variable, strline as a
string and objstreamreader as a streamreader.
Basically I read in a line of a text file - this works fine.
I then read in another line. This works fine
However, the third time round I read character by character, until I
get to to the 40th character on the line, because this is the position
of some information that is a variable that I need. The problem is that
when using the read command (strline = objstreamreader.read) each
character is being given as a number (for example, when a space is read
in the string shows the number "32"). When I get to the correct
character I should get the string "1", instead I'm getting something
else. (A different number, but it's definately a translation of 1, not
the wrong character because all other characters on the line are
letters from a to z).
does anyone know why this happens and how I can re-translate the
number/code back into an alphanumeric version?
thanks,
Steve