Re: String Manipulations
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Tue, 22 Nov 2005 13:58:45 -0500
Mark <mark_ivey4@xxxxxxxxx> wrote:
> Can anyone provide information for how to retrieve the actual
> character string from a CString object?
CString str;
LPCTSTR p = str;
> I am using the following code but it only returns the address of the
> string and not the literal characters of the string. I know it has to
> be something simple that I am overlooking but I have copied samples
> from MS that are supposed to work but give the same results
>
> CString strSports("Hockey is Best!");
>
> TCHAR sz[1024];
>
> lstrcpy(sz, strSports);
>
> cout << strSports ;
Why did you copy into sz buffer if you never use it?
> If I follow documentation provided by Microsoft which states:
> // while this line will put the content of the string out:
>
> cout << (LPCTSTR) strSports;
>
> I still only receive the address of the CString object at the console.
It appears that you are building a Unicode build. If so, use wcout
instead of cout.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: String Manipulations
- From: Mark
- Re: String Manipulations
- References:
- String Manipulations
- From: Mark
- String Manipulations
- Prev by Date: String Manipulations
- Next by Date: Re: Will the following code assert:
- Previous by thread: String Manipulations
- Next by thread: Re: String Manipulations
- Index(es):
Relevant Pages
|