0
基本上我需要將文本框中的文本從UTF-8轉換爲base16(我認爲這是十六進制),並將其寫入文件。將字節從文本框寫入文件從基本流與C#
這可是背單詞:
//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();
威爾是允許的基址產生的? – 2012-04-01 23:12:52
我相信對底層Stream位置的更改也會影響StreamWriter。我目前無法測試,但您應該嘗試一下。 – 2012-04-02 00:18:53