Concatenate two wide strings with a " - " in the middle using library routines - C++ Data Type

C++ examples for Data Type:char

Description

Concatenate two wide strings with a " - " in the middle using library routines

Demo Code

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    wchar_t wcharArray[260];/*w  w w .  ja v a2  s . co m*/
    cout << "Enter string #1:";
    wcin.getline(wcharArray, 128);

    wchar_t wszString2[128];
    cout << "Enter string #2:";
    wcin.getline(wszString2, 128);

    wcsncat(wcharArray, L" - ", 260);
    wcsncat(wcharArray, wszString2, 260);

    wcout << L"\n" << wcharArray << endl;

    return 0;
}

Result


Related Tutorials