I'm trying to read data from a binary file using c# This data is entered using code but I'm getting this exception
The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.
And here is the code :
FileStream fs = new FileStream(path,FileMode.Open);
FileStream fs2 = new FileStream(path2, FileMode.CreateNew);
BinaryReader br = new BinaryReader(fs);
BinaryWriter bw = new BinaryWriter(fs2);
while (br.PeekChar() != -1)
{
bw.Write(br.ReadInt32());
bw.Write(br.ReadString());
}
bw.Close();
br.Close();
fs2.Close();
fs.Close();
the exception is in the peekChar line