//執行EXE
Process.Start("\\NandFlash\\XXX.exe", "");//XXX.exe 要執行的程式
//寫檔案7a64e78988e69d8331333335346164(同理可寫任何檔案)
private void button1_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("\\NandFlash\\XXX.txt", FileMode.Create);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
string str = "寫入我";
sw.WriteLine(str);
sw.Close();
fs.Close();
}
//讀檔案
try
FileStream fs = new FileStream("\\NandFlash\\XXX.txt", FileMode.Open, FileAccess.ReadWrite);
StreamReader readfile = new StreamReader(fs);
byte[] strs = new byte[2048];
string str, ss = "";
int index = 0;
while (readfile.EndOfStream == false)
str = readfile.ReadLine();
ss = str.Trim();
strs[index] = Convert.ToSingle(ss);
index += 1;
ss = "";
readfile.Close();
return 0;
catch
return 1;
//執行EXE
Process.Start("\\NandFlash\\XXX.exe", "");//XXX.exe 要執行的程式
//寫檔案7a64e78988e69d8331333335346164(同理可寫任何檔案)
private void button1_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("\\NandFlash\\XXX.txt", FileMode.Create);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
string str = "寫入我";
sw.WriteLine(str);
sw.Close();
fs.Close();
}
//讀檔案
try
{
FileStream fs = new FileStream("\\NandFlash\\XXX.txt", FileMode.Open, FileAccess.ReadWrite);
StreamReader readfile = new StreamReader(fs);
byte[] strs = new byte[2048];
string str, ss = "";
int index = 0;
while (readfile.EndOfStream == false)
{
str = readfile.ReadLine();
ss = str.Trim();
strs[index] = Convert.ToSingle(ss);
index += 1;
ss = "";
}
readfile.Close();
fs.Close();
return 0;
}
catch
{
return 1;
}