Advertisement

LPCSTR and CHARS

Started by January 01, 2003 07:48 PM
6 comments, last by Tooko 21 years, 10 months ago
I have a list of chars (a total of 23 if you''re interested) and I want to place them neatly into a LPCSTR. How can I do this? Oh, in case it''s relevant, the chars are mostly characters. However, there are two numbers. Any ideas? Come on, you guys are smarter than me... well, if you''re not, I''m stuffed. The past was unknown, the future was predicted.
the future is just like the past, just later. - TANSTAAFL
An LPCSTR is a long pointer to a CString, I believe. Therefore, I think you have to create a CString object and initialize it with your 23 characters. You can probably do something like
LPCSTR pString = new CString(TCHAR("My long string here"));

For more info, go to msdn.microsoft.com and search for CString and/or LPCSTR
Advertisement
an LPCSTR is MS''s way of saying long pointer to a constant string. a string that is not meant to be modified, i.e., read-only.
Read only? Hmm... oh well. Never caused me problems before. Thanks for the help peoples...!

The past was unknown, the future was predicted.
the future is just like the past, just later. - TANSTAAFL
CHAR is same as char but hurts the eyes more to read...

LPCTSTR is a "long pointer to a constant tchar " or in other words a const char *.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
CHAR is same as char but hurts the eyes more to read...

LPCTSTR is a "long pointer to a constant tchar string" or in other words a const char *.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement
Gee wizz! I didn''t know so many people would reply!!!!! That makes me sound really unsocial considering only 3 different people have replied! I am sooo going to shup up now!

The past was unknown, the future was predicted.
the future is just like the past, just later. - TANSTAAFL

  char      YourList[23];   //This is your list of charsLPCTSTR   String = new char[23];memcpy( String, YourList, 23 )  //copy your list of chars to the string... //do whatever you want to do with the stringdelete[] String;  //Don''t forget this  


KaMiKaZe

This topic is closed to new replies.

Advertisement