0

基本的に、テキスト ボックス内のテキストを UTF-8 から base16 に変換し (16 進数が入っていると思います)、ファイルに書き込む必要があります。

これは裏返しの言葉です:

//Setup byte reader.
            FileStream fs = new FileStream(EditOpen.FileName, FileMode.Open);
            BinaryReader br = new BinaryReader(fs);
            long length = fs.Length;
            //Read bytes to textBox1.
            br.BaseStream.Position = 0x00001844; //Min loading address.
            byte[] PT = br.ReadBytes(0x00000428); //Amount of bytes to load (1064 to be exact).

            //Print string PT to textBox1 after converting to UTF-8 and replace 0's with DOT's.
            textBox1.Text = System.Text.Encoding.UTF8.GetString(PT).Replace("\0", ".");
            fs.Close();
4

1 に答える 1

0

最も簡単な方法は、正しいエンコーディングで作成されたStreamWriterを使用することです

  using(StreamWriter sw = 
            new System.IO.StreamWriter(fs, 
                System.Text.UTF8Encoding))
  {
     sw.Write(textBox1.Text);
  }
于 2012-04-01T22:49:57.037 に答える