THY02K
February 13th, 2001, 07:17 PM
Q1
char MyCharArrayA[30] = "Testing: MyCharArray...";
char* MyCharArrayB[30]; //What is this??
//Note: MyCharArrayA is a char* (character pointer) BUT what's MyCharArrayB? Array of char* pointers?
cout << MyCharArrayB will give u an address.
cout << MyCharArrayB[1] will make yr program crash? Why?
Q2
I cant find the typedef for LPCSTR in msdn. The following is extracted from MSDN. Is LPCSTR an operator of CString class? Or Is it an MACRO? Or is it a SDK defined TYPE (definition in some header file?).
FOR YOUR REFERENCE (from MSDN): Win32 Data Types / check out Platform SDK header files:
(1) The letter T in a type definition designates a generic type that can be compiled for either ANSI or Unicode.
(2) The letter W in a type definition designates a wide-character (Unicode) type.
(3) For the actual implementation of this method, see the WINNT.H header file.
// Generic types
#ifdef UNICODE
typedef wchar_t TCHAR;
#else
typedef unsigned char TCHAR;
#endif
typedef TCHAR * LPTSTR, *LPTCH;
// 8-bit character specific
typedef unsigned char CHAR;
typedef CHAR *LPSTR, *LPCH;
// Unicode specific (wide characters)
typedef unsigned wchar_t WCHAR;
typedef WCHAR *LPWSTR, *LPWCH;
Thanks.
char MyCharArrayA[30] = "Testing: MyCharArray...";
char* MyCharArrayB[30]; //What is this??
//Note: MyCharArrayA is a char* (character pointer) BUT what's MyCharArrayB? Array of char* pointers?
cout << MyCharArrayB will give u an address.
cout << MyCharArrayB[1] will make yr program crash? Why?
Q2
I cant find the typedef for LPCSTR in msdn. The following is extracted from MSDN. Is LPCSTR an operator of CString class? Or Is it an MACRO? Or is it a SDK defined TYPE (definition in some header file?).
FOR YOUR REFERENCE (from MSDN): Win32 Data Types / check out Platform SDK header files:
(1) The letter T in a type definition designates a generic type that can be compiled for either ANSI or Unicode.
(2) The letter W in a type definition designates a wide-character (Unicode) type.
(3) For the actual implementation of this method, see the WINNT.H header file.
// Generic types
#ifdef UNICODE
typedef wchar_t TCHAR;
#else
typedef unsigned char TCHAR;
#endif
typedef TCHAR * LPTSTR, *LPTCH;
// 8-bit character specific
typedef unsigned char CHAR;
typedef CHAR *LPSTR, *LPCH;
// Unicode specific (wide characters)
typedef unsigned wchar_t WCHAR;
typedef WCHAR *LPWSTR, *LPWCH;
Thanks.