Re: Char to Wide-Char tool

From: Asmus Freytag (asmusf@ix.netcom.com)
Date: Fri Mar 22 1996 - 16:51:30 EST


This looks like a task for a sed or awk script to me.
You will need to do checking by human reader anyway,
because of malloc issues.

This sample

char * p1 = "1234";
char * p2;
p2 = malloc(strlen(p1)+1);
strcpy(p2,p1);

needs to become

wchar_t * p1 = L"1234";
wchar_t * p2;
p2 = malloc((wcslen(p2+1)*sizeof(wchar_t));
wcscpy(p2,p1);

Note, in C++, when you use the new operator, these issues
disappear.

A./

At 08:37 AM 3/22/96 -0800, you wrote:
>
>I am looking for a tool which will take a C source file using traditional
>character strings and convert it a wide-character based source file. As an
>example, the tool would convert:
>
>char name[10]; -> wchar_t name[10];
>strcpy(name, "Joe"); -> wstrcpy(name, L"Joe");
>
>
>
>
>
>+-----------+---------------------------------+----------------------------+
>| | David O. Craig | Phone: (310) 524-7769 |
>| | Teradata Internationalization | Fax: (310) 524-5516 |
>| N C R | Large Systems Solutions | Office: 16-132 |
>| | 100 N. Sepulveda Blvd. | doc@elsegundoca.attgis.com |
>| | El Segundo, Ca. 90245 | |
>+-----------+---------------------------------+----------------------------+
>
>
>



This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:30 EDT