Solved

converting a LPSTR type into a char array

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

0
Comment
Question by:asaikovs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

691 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