Solved

converting a LPSTR type into a char array

Posted on 2000-05-09
3
927 Views
Last Modified: 2012-06-21
How do I convert a LPSTR value into a char array easily?

0
Comment
Question by:asaikovs
3 Comments
 
LVL 5

Expert Comment

by:Wyn
ID: 2795623
Use LPSTR as is char array,why casting ?
0
 
LVL 2

Accepted Solution

by:
trillo earned 50 total points
ID: 2795692
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
 

Author Comment

by:asaikovs
ID: 2798023
Excellent!!!
Exactly what I was after
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question