array2 CString to char array ● MFC CString to char array CString cs = _T("ABCDE"); CStringA csa(cs); int buff_size = csa.GetLength() + 1; char* buff = new char[buff_size]; memcpy(buff, csa.GetBuffer(), csa.GetLength()); buff[buff_size - 1] = 0x0D; delete[] buff; 2023. 7. 18. string - byte array using System; using System.IO; using System.Text; namespace String_Byte { class Program { static void DisplayBytes(byte[] bytes, bool nextLine = true) { foreach (byte b in bytes) { Console.Write($"{b:X2} "); } if (nextLine) { Console.WriteLine(); } } static void EncodingDefault() { string caseString = "Case 1 - Encoding.Default"; byte[] bytes = Encoding.Default.GetBytes(caseString); Console.Writ.. 2022. 9. 9. 이전 1 다음