converting a LPSTR type into a char array

How do I convert a LPSTR value into a char array easily?

asaikovsAsked:
Who is Participating?
 
trilloConnect With a Mentor Commented:
Supose you have

LPSTR str;
this is the same as declaring
char *str;

To convert Use:
1) Copy the string
char ch[LEN];
strcpy(ch, str);

2) Use it directly...
LPSTR str;
You can access the characters in 'str' as if it was an array
str[0] = 'h';
str[1] = 'e';
str[2] = 'l';
str[3] = 'l';
str[4] = 'o';
str[5] = 0;   // Null character

1
 
WynCommented:
Use LPSTR as is char array,why casting ?
0
 
asaikovsAuthor Commented:
Excellent!!!
Exactly what I was after
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.