R
rajesh.ba
Hi ,
I am trying some sample programs with unicode strings.
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
double* my_len;
wchar_t* my_string = (wchar_t *) malloc(sizeof(wchar_t) *100);
wchar_t* my_string2 = (wchar_t *) malloc(sizeof(wchar_t) *100);
double* my_len1 = (double*)my_string2;
swprintf(my_string,100,L"ABCDEFGH");
my_len = (double*)(my_string);
*(my_len1) = *my_len;
wprintf(L"my string2 is %s\n",my_string2);
wprintf(L"my string is %s\n",my_string);
}
This program gives an output
my string2 is
ABCD??????????????????????????????????????????????????????????????
????????????????????????????????????
my string is ABCDEFGH
How can i make my_string2 to print "ABCDEFGH"?
Regards
Rajesh
I am trying some sample programs with unicode strings.
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
double* my_len;
wchar_t* my_string = (wchar_t *) malloc(sizeof(wchar_t) *100);
wchar_t* my_string2 = (wchar_t *) malloc(sizeof(wchar_t) *100);
double* my_len1 = (double*)my_string2;
swprintf(my_string,100,L"ABCDEFGH");
my_len = (double*)(my_string);
*(my_len1) = *my_len;
wprintf(L"my string2 is %s\n",my_string2);
wprintf(L"my string is %s\n",my_string);
}
This program gives an output
my string2 is
ABCD??????????????????????????????????????????????????????????????
????????????????????????????????????
my string is ABCDEFGH
How can i make my_string2 to print "ABCDEFGH"?
Regards
Rajesh