home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- # include "strings.h"
-
- procedure mkStaticS{(s: String; var p: packed array[lo..hi:Integer] of Char)};
- {
- * Converts a dynamic string into a static string.
- * p is null padded if necessary.
- * Info will be lost if lengthS(s) > hi-lo+1.
- }
- var i: Integer; j: Nat1; lens: Nat0; ch,null: Char; sp: CharOfString;
- begin
- j := 1; lens := lengthS(s); null := chr(0);
- if lens <> 0 then
- first(sp, s);
- for i := lo to hi do
- if j <= lens then begin
- next(sp, ch);
- p[i] := ch;
- j := j+1
- end
- else
- p[i] := null
- end{ -- mkStaticS};
-