When I try your code here:
string sFilePath = @"D:\Temp\BBbinwriter.hex";
FileMode fMode = FileMode.Create;
string sDataToWrite = File.ReadAllText(@"D:\Temp\101.txt");
using (FileStream objFileStream = new FileStream(sFilePath, fMode))
{
using (BinaryWriter objStreamWriter = new BinaryWriter(objFileStream))
{
objStreamWriter.Write(sDataToWrite.ToCharArray()); objStreamWriter.Flush();
objStreamWriter.Close();
}
objFileStream.Close();
}
I get two identical files - the same length, the same data. What am I doing that you aren't, or you doing that I'm not?
I can only assume that it is a data problem, and your sDataToWrite does not contain what you think it does...:laugh: