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.IO;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using System.Globalization;
  11. using System.Collections;
  12.  
  13. namespace WindowsFormsApplication1
  14. {
  15. public partial class Form1 : Form
  16. {
  17. public Form1()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24. string path = Application.StartupPath + @"\test01.DAT";
  25.  
  26. //byte配列へ変換
  27. StreamReader ss = new StreamReader(path, Encoding.GetEncoding("Shift_JIS"));
  28. string text = ss.ReadToEnd();
  29. ss.Close();
  30. byte[] data = Encoding.GetEncoding("Shift_JIS").GetBytes(text);
  31.  
  32. data[3] = 66;
  33.  
  34. //上書き更新
  35. StreamWriter sw = new StreamWriter(path, false, Encoding.GetEncoding("shift_jis"));
  36. sw.Write(Encoding.GetEncoding("shift_jis").GetString(data));
  37. sw.Close();
  38. }
  39. }
  40. }
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(5,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(9,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 3 error(s), 0 warnings
stdout
Standard output is empty