473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

can I use strlen with LPCTSR ?

2 1201
Hi Lucy!

You should use

_tcslen

also all other tchar-function, if you are using TCHAR or LPCTSTR or LPTSTR

See: Generic-Text Mappings in TCHAR.H
http://msdn2.microsoft.com/en-us/library/c426s321.aspx

Greetings
Jochen
Sep 5 '06 #2
Ray
Lucy Ludmiller wrote:
>
If you sure that you're never going to do a Unicode build, you *can*,
but that doesn't mean you should. Instead of a const char*, LPCTSTR is
actually a pointer to a TCHAR, which changes depending on your build.

To be safe you should always use the _tcs variants of string functions.
Typically you just replace the prefix "str" with "_tcs", e.g.:

strcmp --_tcscmp
strlen --_tcslen

And so on.

Cheers
Ray
Sep 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: sugaray | last post by:
hi, it just came up my mind that since we can get the length of any given string literal S with 'sizeof S-1', so, what's the merit of library function strlen()'s existence ? thanx in advance for...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
33
by: apropo | last post by:
what is wrong with this code? someone told me there is a BAD practice with that strlen in the for loop, but i don't get it exactly. Could anyone explain me in plain english,please? char...
66
by: roy | last post by:
Hi, I was wondering how strlen is implemented. What if the input string doesn't have a null terminator, namely the '\0'? Thanks a lot Roy
83
by: rahul8143 | last post by:
hello, what is difference between sizeof("abcd") and strlen("abcd")? why both functions gives different output when applied to same string "abcd". I tried following example for that. #include...
10
by: danielesalatti | last post by:
Hello!! I'm studying c++ and I'm trying to get a little piece of code working, but I'm getting a segfault with strlen here: void tabhash::set (url *U) { uint hash = U->hashCode(); char* url =...
2
by: Chris | last post by:
Hi there, I have been reading in this group for a while really enjoy this pool of infinite c wisdom. :) Anyway, I have question now. I have this little piece of code that is giving me a...
53
by: ¬a\\/b | last post by:
strlen is wrong because can not report if there is some error e.g. char *a; and "a" point to an array of size=size_t max that has no 0 in it
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.