If need LPCTSTR, it's not absolutely necessary an explicit cast (see example #3 vs. #2).
After a call of GetBuffer, don't forget to call ReleaseBuffer (see example #4).
Important: an often made mistake is to use double cast (LPTSTR)(LPCTSTR). This is not OK and can lead in troubles:
// GetSystemDirectory gets LPTSTR
// Bang!!! The program can crash, sooner or later.
So, never do that! Call GetBuffer instead, as shown in example #4.
CString::GetString is not available in MFC6.0 and older. Use opertor LPCTSTR which at last does the same.
In newer MFC versions, CString is implemented using templates, then you can find the methods and operators docummented at CStringT and CSimpleStringT. Also, you can find operator PCXSTR instead of LPCTSTR.
Anyway, you can still use the "old syntax", as shown in the above examples.