From: David Ching on
"Luigino" <npuleio(a)rocketmail.com> wrote in message
news:a6584f98-f862-4fb9-a9fd-f2f9542dbd3f(a)b7g2000yqd.googlegroups.com...
> Hello everyone,
>
> I'm trying to truncate with a certain LPCTSTR string to n position and
> get another LPCTSTR variable truncated by that n position....
>
> Is it possible? Any hint?...
>

Is this a homework assignment?

-- David

From: Joseph M. Newcomer on
Your fundamental error is in thinking LPCTSTR is a sensible data type. You should be
using CString.

CString s;
s = ...;

CString truncated_s(s.Left(n));
CString rest_of_s(s.Mid(n + 1));

In MFC, it RARELY makes sense to be using LPCTSTR for any data in your own program. It is
something to be used under rare and exotic circumstances. In the worst case, I might
write a couple LPTSTR declarations in a program, mostly to get writeable buffers for API
calls. But I would never consider LPCTSTR as a reasonable data structure for ordinary
work. Or LPTSTR, either.

If you are seriously using LPTSTR/LPCTSTR, you should reconsider how you are writing code.
joe



On Fri, 5 Mar 2010 07:42:53 -0800 (PST), Luigino <npuleio(a)rocketmail.com> wrote:

>Hello everyone,
>
>I'm trying to truncate with a certain LPCTSTR string to n position and
>get another LPCTSTR variable truncated by that n position....
>
>Is it possible? Any hint?...
>
>Thanks
>Ciao
>Luigi
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
First  |  Prev  | 
Pages: 1 2
Prev: OnClose() in CPropertySheet
Next: Truncate a LPCTSTR