私はC#が初めてで、非常に基本的な問題に悩まされています。
いくつかのデータ (「hello」など) を含む 1 つのテキスト ファイルを読み込んでいます。このデータを以下のコードのように読み込んでいます。
System.IO.Stream myStream;
Int32 fileLen;
StringBuilder displayString = new StringBuilder();
// Get the length of the file.
fileLen = FileUploadId.PostedFile.ContentLength;
// Display the length of the file in a label.
string strLengthOfFileInByte = "The length of the file is " +
fileLen.ToString() + " bytes.";
// Create a byte array to hold the contents of the file.
Byte[] Input = new Byte[fileLen];
// Initialize the stream to read the uploaded file.
myStream = FileUploadId.FileContent;
// Read the file into the byte array.
//myStream.Read(Input, 0, fileLen);
myStream.Read(Input, 0, fileLen);
// Copy the byte array to a string.
for (int loop1 = 0; loop1 < fileLen; loop1++)
{
displayString.Append(Input[loop1].ToString());
}
// Display the contents of the file in a
string strFinalFileContent = displayString.ToString();
return strFinalFileContent;
「こんにちは」を「strFinalFileContent」の値にする必要があります。「104 101 108 108 111」は ASCII 文字の 10 進数値を意味します。出力として「hello」を取得する方法を教えてください。些細な質問かもしれませんが初心者なので教えてください。