[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
вин апи начало
vilgosДата: Ср, 09 Сен 2015, 20:24 | Сообщение # 1
Старший программист
Группа: Модераторы
Сообщений: 76
Репутация: 0
Статус: Offline
Код
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <Windows.h>
#include <iostream>
#include <conio.h>
#include <string>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
  setlocale(NULL, "RU-ru");
  //-------------------------------------------------------
  wchar_t *str1 = L"SImple unicode string";
  wchar_t *str2 = L"Простой unicode рядок";
  wcout << str1 << endl << str2<<endl;
  //-------------------------------------------------------
  wchar_t ch = 'a';
  cout <<"long char\t"<< sizeof(ch)<<endl;
  cout <<"char\t\t"<< sizeof('a') << endl;
  //-------------------------------------------------------
  wchar_t *str3 = L"SImple unicode string";
  char*outArr = new char[wcslen(str3)/2];
  wcstombs(outArr, str3, wcslen(str3));
  cout << outArr << endl;
  //------------------------------------------------------
  char*str4 = "bla bla bla";
  wchar_t *outArr2 = new wchar_t[strlen(str4)];
  mbstowcs(outArr2, str4, strlen(str4));
  wcout << outArr2; cout << endl;
  //------------------------------------------------------
  size_t *s1 = nullptr;
  wchar_t *str5 = L"SImple unicode string";
  char*outArr3 = new char[wcslen(str5) / 2];
  wcstombs_s(s1, outArr3, strlen(outArr3), str3, wcslen(str5));
  cout << outArr3 << endl;

  _gettch();
  return 0;
}

 
  • Страница 1 из 1
  • 1
Поиск: