Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Misc > Re: ShortString...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 723 of 814
Post > Topic >>

Re: ShortString to PChar

by Marco van de Voort <marcov@[EMAIL PROTECTED] > Feb 27, 2007 at 08:46 AM

On 2007-02-26, Dennis-Bendert Schramm <dennisschramm@[EMAIL PROTECTED]
> wrote:
> Well, I wanted to do the following:
>
> var menustring:array[0..9]of string;
>
> begin
> 	menustring[0]:='String A';
>     	menustring[1]:='String B';
> 	menustring[2]:='String C';
>     	menustring[3]:='String D';
>     	menustring[4]:='String E';
>     	menustring[5]:='String F';
> 	...
> 	mvprintw(1,1,menustring[0],[]);
> 	mvprintw(2,1,menustring[1],[]);
> 	...
> end.

var menustring : array[0..9] of ansistring =('String A','String B','String
C', 'String...');

for i:=low(menustring) to high(menustring) do
     mvprintw(i+1,1,pchar(menustring[i],[]);

> Incompatible type for arg no. 2: Got "AnsiString", expected "PChar"
>
> I tried to create a PChar array instead (...array[0..9]of PChar;) but 
> then my app crashes.

Simply typecast it (which is a "real" typecast, IOW a nop) An ansistring
is
like a pchar, and then something more. Keep in mind though that an
ansistring can contain #0's, and a pchar not.


> Thanks in advance,
>
> Dennis B. Schramm
 




 7 Posts in Topic:
ShortString to PChar
Dennis-Bendert Schramm &l  2007-02-26 22:26:13 
Re: ShortString to PChar
Marco van de Voort <ma  2007-02-26 21:29:16 
Re: ShortString to PChar
Dennis-Bendert Schramm &l  2007-02-26 23:45:19 
Re: ShortString to PChar
Wolf Behrenhoff <NoSpa  2007-02-26 23:56:02 
Re: ShortString to PChar
Marco van de Voort <ma  2007-02-27 08:46:02 
Re: ShortString to PChar
Dennis-Bendert Schramm &l  2007-02-27 23:29:07 
Re: ShortString to PChar
"Richard Engebretson  2007-02-27 05:01:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 6:56:02 CDT 2008.