I don't think you have to "convert a wide string (in this case a utf16 string) to a utf8 string", instead you can save the utf16 string directly to a file - whether using C++ streams or the C file IO API, you just need Just save in binary mode instead of text mode.
If you want to convert without using std, do it with CW2A, which is short compared to std's long and ugly function names:
#include <iostream>
#include <fstream>
using namespace std;
void CTestDlg::OnBnClickedOk()
{
LPCTSTR lpsz = L"한국어 some Unicode string にちほん";
CStringA s(CW2A(lpsz, CP_UTF8));
ofstream fu8(".\\bin_u8.txt", ios_base::binary);
fu8.write(s, s.GetLength() );
}