Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

_tclen() always returns 1!!

352 views
Skip to first unread message

Andrew T. Brown

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

_tclen maps to routines for determining the length of a multibyte CHARACTER,
not a string.

Use _tcslen(), which maps to strlen() or it's MBCS or UNICODE equivalents.

Also, you may be interested in using _tmain() and _tprintf(), as well as
using the _T() macro to "wrap" constant strings in your source. See the
documentation for details.

Andrew

Naresh Bhatia wrote in message ...
>I am trying to use the generic text function _tclen(), but it is
>always returning a 1. Here's an example:
>
>#include <stdio.h>
>#include <tchar.h>
>
>void main()
>{
> printf("%d", _tclen("Hello"));
>}
>
>Does anyone know what I am doing wrong? If I replace _tclen() with
>strlen() then it correctly returns 5.
>
>Thanks.
>
>Naresh
>
>

Naresh Bhatia

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

Naresh Bhatia

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

Thanks. That explains it. I overlooked the word "CHARACTER" in the
documentation!!

Naresh

>_tclen maps to routines for determining the length of a multibyte CHARACTER,
>not a string.

>Use _tcslen(), which maps to strlen() or it's MBCS or UNICODE equivalents.

>Also, you may be interested in using _tmain() and _tprintf(), as well as
>using the _T() macro to "wrap" constant strings in your source. See the
>documentation for details.

>Andrew

>Naresh Bhatia wrote in message ...

Antares

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

Use _tcslen.

Juergen

--
*** Remove .NOSPAM junkbot confuser to reply ***

Naresh Bhatia <bha...@mediaone.net> wrote in article
<eqVK9xy...@uppssnewspub05.moswest.msn.net>...

0 new messages