G
Guest
I really don't achieve to read a simple 'input.txt' with the following content:
Jürg (Hex: 4a fc 72 67)
to an identical 'output.txt'
I do the following (and tried with tons of different encodings):
private static void WriteFile() {
StreamWriter sr = File.CreateText("Output.txt");
try
{
using (TextReader tr = new StreamReader(new
FileStream("Input.txt",FileMode.Open),Encoding.ASCII ))
{
string iniLine = "";
while ((iniLine = tr.ReadLine()) != null)
{
if (iniLine.Length > 0)
sr.WriteLine(iniLine);
}
tr.Close();
}
}
catch
{
sr.Close();
}
sr.Flush();
sr.Close();
}
But in Output I NEVER have exactly the same Hex values as in Input. Isn't
there a way to say "take the same encoding as the input" ?
Thanks for your help
Jürg (Hex: 4a fc 72 67)
to an identical 'output.txt'
I do the following (and tried with tons of different encodings):
private static void WriteFile() {
StreamWriter sr = File.CreateText("Output.txt");
try
{
using (TextReader tr = new StreamReader(new
FileStream("Input.txt",FileMode.Open),Encoding.ASCII ))
{
string iniLine = "";
while ((iniLine = tr.ReadLine()) != null)
{
if (iniLine.Length > 0)
sr.WriteLine(iniLine);
}
tr.Close();
}
}
catch
{
sr.Close();
}
sr.Flush();
sr.Close();
}
But in Output I NEVER have exactly the same Hex values as in Input. Isn't
there a way to say "take the same encoding as the input" ?
Thanks for your help