Hello ;
you can try that for reading the file :
public byte[] ReadByteArrayFromFile(string fileName)
{
byte[] buff = null;
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
long numBytes = new FileInfo(fileName).Length;
buff = br.ReadBytes((int)numBytes);
return buff;
}
or :
using System.IO;
private static void SendTextFile( SerialPort port, string FileName)
{ port.Write(File.OpenText(FileName).ReadToEnd()); }
private static void SendBinaryFile( SerialPort port, string FileName)
{
using (FileStream fs = File.OpenRead(FileName))
port.Write((new BinaryReader(fs)).ReadBytes( (int)fs.Length), 0, (int)fs.Length);
}
and for more detials try that links :
http://www.dreamincode.net/forums/topic/35775-serial-port-communication-in-c%23/[
^]
regards..