utilitylibraries/libutils/tsrc/src/test_wstringtotptrc8_positive_unicode.cpp
changeset 22 ddc455616bd6
parent 0 e4d67989cc36
child 45 4b03adbd26ca
child 57 2efc27d87e1c
equal deleted inserted replaced
18:47c74d1534e1 22:ddc455616bd6
    18 #include <stdio.h>
    18 #include <stdio.h>
    19 #include<e32std.h>
    19 #include<e32std.h>
    20 #include "libutils.h"
    20 #include "libutils.h"
    21 #include"std_log_result.h"
    21 #include"std_log_result.h"
    22 #define LOG_FILENAME_LINE __FILE__, __LINE__
    22 #define LOG_FILENAME_LINE __FILE__, __LINE__
    23 void main()
    23 int main()
    24 {
    24 {
    25     int retval =ESuccess, len = 0;
    25     int retval =ESuccess, len = 0;
    26     wstring W(L"\xAE");
    26     wstring W(L"\xAE");
    27     __UHEAP_MARK;
    27     __UHEAP_MARK;
    28     TPtrC8 buf;
    28     TPtrC8 buf;
    29     char *temp = new char [23];
    29     char *temp = new char [23];
    30     retval = WstringToTptrc8(W, temp, buf);
    30     retval = WstringToTptrc8(W, temp, buf);
       
    31     if(retval == 0)
       
    32     printf("Conversion successful\n");
    31 
    33 
    32     wchar_t *wChar = new wchar_t[2];
    34     wchar_t *wChar = new wchar_t[2];
    33     len = wcslen(W.c_str());
    35     len = wcslen(W.c_str());
    34     mbstowcs(wChar , (const char *)buf.Ptr(), len);
    36     mbstowcs(wChar , (const char *)buf.Ptr(), len);
    35     wChar[1]= L'\0';
    37     wChar[1]= L'\0';
    46     delete[] temp;
    48     delete[] temp;
    47     wChar = NULL;
    49     wChar = NULL;
    48     temp = NULL;
    50     temp = NULL;
    49     __UHEAP_MARKEND;
    51     __UHEAP_MARKEND;
    50     testResultXml("test_wstringtotptrc8_positive_unicode");
    52     testResultXml("test_wstringtotptrc8_positive_unicode");
       
    53 	return 0;
    51 }
    54 }