Good news: This writes legibly:
#ifdef UNICODE int lenBIG = GetWindowTextLength(GetDlgItem(hWnd, IDC_BIGNUM)); wchar_t* BIGw2 = new WCHAR[lenBIG+1]; GetDlgItemText(hWnd, IDC_BIGNUM, BIGw2, FALSE); wchar_t* kvalue; wchar_t* nvalue; wchar_t* formula; wchar_t* fractors; wchar_t* dijits; char * cstr; int lenk = GetWindowTextLength(GetDlgItem(hWnd, IDC_ENTER_K)); kvalue=new WCHAR[lenk+1]; int lenn = GetWindowTextLength(GetDlgItem(hWnd, IDC_ENTER_N)); nvalue=new WCHAR[lenn+1]; int lenf = GetWindowTextLength(GetDlgItem(hWnd, IDC_PROTH)); formula=new WCHAR[lenf+1]; int lenfr = GetWindowTextLength(GetDlgItem(hWnd, IDC_FACTORS)); fractors=new WCHAR[lenfr+1]; int lend = GetWindowTextLength(GetDlgItem(hWnd, IDC_DIGITS)); dijits=new WCHAR[lend+1]; std:wstring fullresults; GetDlgItemText(hWnd, IDC_ENTER_K, kvalue, FALSE); GetDlgItemText(hWnd, IDC_ENTER_N, nvalue, FALSE); GetDlgItemText(hWnd, IDC_PROTH, formula, FALSE); GetDlgItemText(hWnd, IDC_FACTORS, fractors, FALSE); GetDlgItemText(hWnd, IDC_DIGITS, dijits, FALSE); fullresults = kvalue; fullresults += L" was your value of k.\n\n"; fullresults += nvalue; fullresults += L" was your value of n.\n\n"; fullresults += formula; fullresults += L" is the formula of this Proth number, which has "; fullresults += dijits; fullresults += L" digits.\n\n"; fullresults += fractors; fullresults += L"Below is your Proth number!\r\n\r\n)"; fullresults += BIGw2; const wchar_t *frchar = fullresults.c_str(); WriteFile( hFile, frchar, wcslen(frchar), NULL, NULL ); CloseHandle(hFile); #endif
Bad news: It only writes WORDS legibly. The numbers are, well, not numbers. Not Korean, either. But not correct.
Ought I use std::wstring for the GetDlgItemText() or what? clearly there is something a bit wrong with the way I store those values in strings. I will try some different techniques.

New Topic/Question
Reply




MultiQuote




|