# what is it? operator? function? a type redefine?

This topic is 4719 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

what is LPCTSTR CString::operator LPCTSTR operator LPCTSTR ( ) const; Return Value A character pointer to the string's data.

##### Share on other sites
LPCSTR is a windows type namely a "Long Pointer (to) C String" i.e. a char*.
and the operator is a conversion operator, that let's you automagicly get a LPCSTR from a CString so you can use it convieniently with functions taking char*.

##### Share on other sites
you mean conversion is one kinds of operator??

##### Share on other sites
Quote:
 Original post by derek7you mean conversion is one kinds of operator??

What I mean is that you can define own conversion operators for classes and it's sometimes convinent todo so. I guess the most familiar is conversion to bool for streams that lets you write code like:
Thing thing;while( std::cin >> thing)  DoStuffWith( thing);
;

##### Share on other sites
Quote:
Original post by DigitalDelusion
Quote:
 Original post by derek7you mean conversion is one kinds of operator??

What I mean is that you can define own conversion operators for classes and it's sometimes convinent todo so. I guess the most familiar is conversion to bool for streams that lets you write code like:
Thing thing;while( std::cin >> thing)  DoStuffWith( thing);
;

I mean << is a operator just like + = * ...

but a conversion is a operator too.? like (char*)

##### Share on other sites
Quote:
 Original post by derek7but a conversion is a operator too.? like (char*)

Yes. A conversion can either go through a conversion constructor (i.e. any non-explicit one-parameter constructor like Foo::Foo(Bar) ) or through a conversion operator (e.g. Bar::operator Foo()).

##### Share on other sites
Quote:
 Original post by DigitalDelusionLPCSTR is a windows type namely a "Long Pointer (to) C String" i.e. a char*.

Almost. I'm pretty sure the actual typedefs are as follows:

LPSTR - char*
LPCSTR - const char*
LPWSTR - wchar_t*
LPCWSTR - const wchar_t*

LPTSTR and LPCTSTR are either defined as LPSTR/LPCSTR or LPWSTR/LPCWSTR depending on whether you're building in Unicode mode or not.

##### Share on other sites
if you are using visual c++ (i dont know if others supports) you can right click the data type and click on "Go to Definition". that will show you the meaning of data type.
but there are some tipsto know it, like it starts with LP so it is a long pointer...etc

• 23
• 10
• 19
• 15
• 14