[unixODBC-support] Unicode and Wide Char strings

Nick Gorham nick at lurcher.org
Tue Oct 19 11:06:42 BST 2010


Neha Avasthy wrote:
> To add to this , In the example below
>
> _T("SELECT NULL FROM DUAL"); expands to
> L"SELECT NULL FROM DUAL";
>
> Thanks
> -Neha
>
Its not much help, as I think you are stuck not using the L format, I 
normally use functional assignment.

TCHAR str[ 100 ];

copy_to_ucode( str, sizeof( str ), "SELECT NULL FROM DUAL" );

Where copy_to_unicode is written to do the right thing.

If you wanted, you could probably do something more complex using 
alloca(), making copy_to_unicode return the address of the passed memory 
address.

#define _T(x)      ( copy_to_unicode( alloca( strlen((x)) + 1),  
strlen((x)) + 1,  (x)))

-- 
Nick


More information about the unixODBC-support mailing list