FileStream file_path = new FileStream(@BinFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
BinaryReader bin_read = new BinaryReader(file_path);
int dl = System.Convert.ToInt32(file_path.Length);
//讀取位元陣列
byte[] InData;
//讀取資料
InData = bin_read.ReadBytes(dl);
//釋放資源
bin_read.Close();
file_path.Close();
FileStream temp_file_path = new FileStream(@TempBinFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
BinaryWriter bin_write = new BinaryWriter(temp_file_path);//創建BIN文件流
bin_write.Write(InData);
bin_write.Seek(8, SeekOrigin.Begin);//修改BIN文件位置從第8字節
bin_write.Write((byte)0x01);//第8字節改為01
bin_write.Write((byte)0x02);//第9字節改為02
bin_write.Write((byte)(0x90));//第10字節改為90
bin_write.Close();
temp_file_path.Close();
延伸閱讀
- C# 讀取超大檔案方式(2024/07)
- C# 利用ffmpeg將WebCAM影像Streaming to RTSP server(2024/08)
- Tektronix MSO64B C# GUI Application(2024/09)
- 坦聯 旋轉轉台控制小工具(2025/02)
- Agilent 34401A 萬用電表 控制介面設計(2026/09)
沒有留言:
張貼留言