I get garbage characters after "Hello" either i print it to the console or write it to a file.
How to print out only "Hello" ?
Code:int main(void) { WCHAR* buf3=L"Hello world!",buf4[32]; wcsncpy(buf4, buf3,6); wprintf (L"%s",buf4); FILE * file = _wfopen(L"uni", L"w"); fwrite(buf4, sizeof(wchar_t), wcslen( buf4 ), file); free(buf3); return 0; }