what is it? operator? function? a type redefine?
what is LPCTSTR
CString::operator LPCTSTR
operator LPCTSTR ( ) const;
Return Value
A character pointer to the string's data.
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*.
Hope that answers your question.
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*.
Hope that answers your question.
Quote:Original post by derek7
you 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);
;
Quote:Original post by DigitalDelusionQuote:Original post by derek7
you 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*)
Quote:Original post by derek7
but 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()).
Quote:Original post by DigitalDelusion
LPCSTR 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.
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
but there are some tipsto know it, like it starts with LP so it is a long pointer...etc
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement