I have opened a file in Notepad++ and it looks like the attached image. What do these symbols represent? Hex/Ascii/Binary? I would like to read and write to a separate file. I used StreamReader and StreamWriter and read write character by character but the resultant file has symbols which are different than the input file.
Since the file size is massive, I would like to use stream.
If you just want to copy the exact binary data, without caring whether it's text or not, you should be using Stream
. For example:
using (var input = Stream.OpenRead(inputFile))
using (var output = Stream.OpenWrite(outputFile))
{
input.CopyTo(output);
}
When you use StreamWriter
, you're interpreting the data as text data in a particular encoding - and if it's not text, or it's not in that encoding, then you'll end up with garbage, basically.
See more on this question at Stackoverflow