Solved

Converting an array of char to a string...

Posted on 1998-03-21
2
328 Views
Last Modified: 2010-04-06
Hi...
  Very simple. How do I convert an array of char to a string variable? I have a variable x which is declared as array[1..200] of char and I have a string variable y. I simply want the contents of x to go into y. I tried the 'Strpas' function to convert a null-terminated string to Pascal type sting but it gave me an error 'Incompatible types : Array and PChar'. There must be an easy way to do this. Can you help?

Cheers!
   Shawn Halfpenny
   drumme59@sprint.ca
0
Comment
Question by:aztec
[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
2 Comments
 
LVL 2

Accepted Solution

by:
rene100 earned 50 total points
ID: 1360685
Hi aztec

in fact, you mustn't convert the types. You simply can use
y:=x; that fills y with all 200 chars of x. if you want to get
only a few of the chars, use y:=copy(x,StartIndex,Count);

regards
rene100
0
 

Author Comment

by:aztec
ID: 1360686
You are quite right! Thanks!

I mistakenly entered the same question as this twice. Can someone delete the other one?

Thanks
   Shawn
0

Featured Post

Independent Software Vendors: 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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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