Hi, Thanks for your suggestions. I had actually used wsclen() in the sample code. I was trying with strlen( and passing the string as Charset.Auto) as well as wcslen( and passing the string as Charset.Unicode). So, it was a copy-paste problem. Sorry about that.
Thanks again, Regards Kala B. --- Jonathan Pryor <[EMAIL PROTECTED]> wrote: > Corrections... > > On Thu, 2004-12-16 at 21:22 -0500, Jonathan Pryor > wrote: > <snip/> > > > Contents of testlib.c > > > --------------------- > > > #include <stdio.h> > > > #include <wchar.h> > > > > > > typedef struct _id > > > { > > > int len; > > > wchar_t name[256]; > > > > Change "name" to the following and things work > better: > > > > unsigned char name[256]; > > This should be "unsigned short", not "unsigned > char", obviously. > > <snip/> > > > printf("wcslen returns.. > %d\n",strlen(id->name)); > > > > Besides, you're not even using wcslen here, you're > using strlen here. > > OF COURSE it'll return "1" -- it'll hit the "null" > embedded in the first > > wide character. > > Thinking about it, it'll be 0 or 1, depending on the > endian-ness of your > platform. The character 'p' will be 0x0070, so on > little-endian > architectures strlen will return 1 while it will > return 0 on big-endian > architectures. Silly me. > > - Jon > > > _______________________________________________ > Mono-list maillist - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list > ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list