?
Solved

converting a LPSTR type into a char array

Posted on 2000-05-09
3
Medium Priority
?
1,029 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

862 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