Answer the question
In order to leave comments, you need to log in
Where do characters come from after saving a file?
There is an array of bytes, I output it to the crane, save it to a file via:
static void saveFile(string fileName, byte[] data)
{
FileStream fileStream = new FileStream(fileName, FileMode.OpenOrCreate);
fileStream.Write(data, 0, data.Length);
fileStream.Close();
}
static byte[] readFile(string fileName)
{
FileStream fileStream = File.OpenRead(fileName);
byte[] fileDataBytes = new byte[fileStream.Length];
fileStream.Read(fileDataBytes, 0, fileDataBytes.Length);
fileStream.Close();
return fileDataBytes;
}
Answer the question
In order to leave comments, you need to log in
By doing this:
FileStream fileStream = new FileStream(fileName, FileMode.OpenOrCreate);
fileStream.Write(data, 0, data.Length);
fileStream.Close();
You write from byte 0 and FileStream does not give you any profit, just use System.IO.File, there should not be any problems, almost everything is set by default.
Can you post the output? Specifically: the input byte array, what did it store, and what did it read?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question