Jump to content
  • Advertisement
Sign in to follow this  
derek7

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

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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);
;

Share this post


Link to post
Share on other sites
Quote:
Original post by DigitalDelusion
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);
;



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

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

Share this post


Link to post
Share on other sites
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()).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!