Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Localization : Is CString::Left() function safe?

Posted on 2000-03-05
2
Medium Priority
?
288 Views
Last Modified: 2007-12-19
If I am writing a UNICODE app, is it safe to use the CString Left() function (i.e. CString s = x.Left(5) where x is also a CString with a value in it?

Or do I need to do something like: s = x.Left(5 * sizeof(TCHAR))

Thanks.
0
Comment
Question by:rascal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
mnewton022700 earned 400 total points
ID: 2586371
It is definitely safe. I've worked with CString under UNICODE for quite some time and have never had any problems.

Left extracts the given number of characters whether they be TCHARs or simply chars.

0
 

Expert Comment

by:Pyr0
ID: 8018799
I used the Left function and it did not extract anything... it returned the entire word!! ?????
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question