fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. string path = Application.StartupPath + @"\test01.DAT";
  23.  
  24. //byte配列へ変換
  25. FileStream fsr = new FileStream( path,FileMode.Open,FileAccess.Read);
  26. byte[] data = new byte[fsr.Length];
  27. fsr.Read(data, 0, data.Length);
  28. fsr.Close();
  29. fsr.Dispose();
  30. data[3] = 66;
  31.  
  32. //上書き更新
  33. FileStream fsw = new FileStream(path, FileMode.Create, FileAccess.Write);
  34. fsw.Write(data, 0, data.Length);
  35. fsw.Close();
  36. fsw.Dispose();
  37. }
  38. }
  39. }
  40.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty