Talk About Network



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 > freepascal stri...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 19 Topic 718 of 792
Post > Topic >>

freepascal strings

by "Richard Engebretson" <eng@[EMAIL PROTECTED] > Feb 17, 2007 at 07:16 PM

Freepascal follows the turbo-pascal string type convention. Walter
Savitch's book calls them "turbo-strings." They have some different
properties that make them both useful and difficult. I hope the real
freepascal experts will correct my errors.

First, the string data type is created at compile time. Unlike C
pointers created dynamically.

Second, a Pascal string is an indexed array. So a character can be
addressed like S[3]. A length byte is at S[0].

Third, string variables are passed to procedures as pointers.

To create C strings (null terminated pointers to a sequence of
characters) one might do the following;

Function Create_Cstring(PascalString : String) : Cstring;
    Var NewString : String;
          Convert_To_Cstring : Cstring;
    Begin
        NewString := PascalString + Chr(0) ;
        Convert_To_Cstring := @[EMAIL PROTECTED]
 ;
        Create_Cstring := StrNew(Convert_To_Cstring) ;
    End;

These capabilities seem assets and not liabilities.

Turbo-Strings are different with some good reasons. Not necessarily a
fault.




 19 Posts in Topic:
freepascal strings
"Richard Engebretson  2007-02-17 19:16:39 
Re: freepascal strings
Wolf Behrenhoff <NoSpa  2007-02-18 14:01:05 
Re: freepascal strings
"Richard Engebretson  2007-02-19 03:13:17 
Re: freepascal strings
Wolf Behrenhoff <NoSpa  2007-02-19 15:22:41 
Re: freepascal strings
CBFalconer <cbfalconer  2007-02-19 19:04:06 
Re: freepascal strings
"Richard Engebretson  2007-02-19 09:09:46 
Re: freepascal strings
Marco van de Voort <ma  2007-02-19 20:41:13 
Re: freepascal strings
Wolf Behrenhoff <NoSpa  2007-02-19 22:09:24 
Re: freepascal strings
Marco van de Voort <ma  2007-02-20 08:38:07 
Re: freepascal strings
Wolf Behrenhoff <NoSpa  2007-02-20 13:58:34 
Re: freepascal strings
Jonas Maebe <Jonas.Mae  2007-02-20 14:58:14 
Re: freepascal strings
"Richard Engebretson  2007-02-19 09:37:20 
Re: freepascal strings
Wolf Behrenhoff <NoSpa  2007-02-19 21:19:34 
Re: freepascal strings
Marco van de Voort <ma  2007-02-19 20:43:07 
Re: freepascal strings
Wolf Behrenhoff <NoSpa  2007-02-19 21:56:35 
Re: freepascal strings
Marco van de Voort <ma  2007-02-19 21:19:37 
Re: freepascal strings
Marco van de Voort <ma  2007-02-19 21:27:00 
Re: freepascal strings
CBFalconer <cbfalconer  2007-02-19 19:07:59 
Re: freepascal strings
"Richard Engebretson  2007-02-19 13:15:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Mon May 12 21:44:49 CDT 2008.