Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ucla-cs!cit-vax!oberon!sdcrdcf!trwrb!trwrc!agnew From: agnew@trwrc.UUCP (R.A. Agnew) Newsgroups: comp.lang.pascal Subject: Re: String formatting function needed Message-ID: <220@trwrc.UUCP> Date: Fri, 4-Sep-87 13:31:51 EDT Article-I.D.: trwrc.220 Posted: Fri Sep 4 13:31:51 1987 Date-Received: Sat, 5-Sep-87 23:08:03 EDT References: <1833@tekig5.TEK.COM> Reply-To: agnew@trwrc.UUCP (R.A. Agnew) Organization: TRW/MEAD San Diego, Ca. Lines: 29 Keywords: string, formatting, sprintf In article <1833@tekig5.TEK.COM> tomm@tekig5.TEK.COM (Tom Milligan) writes: > > I am looking for a Pascal implementation of a string formatting >function. It should have functionality similar to the "sprintf" function > I have written a very extensive dynamically allocated string package for Green Hills Pascal, Sun/Berkeley Pascal, and Ada. It utilizes many of the built-in Unix c functions, including sprintf, by just declaring them external to a compatible type. The following is part of Strings.h type string16 = packed array[1..16] of char; (* This is a dummy def *) String = ^string16; function strlen(S: String): integer; external; function strcpy(S1, S2: String): String; external; function strcmp(S1, S2: String): integer; external; function strcat(S1, S2: String): String; external; function strsave(S: String): String; external; function atol(s: String): integer; external; function atof(s: String): real; external; function gets(s: String): String; external; function malloc(size: integer): String; external; function realloc(S: String; size: integer): String; external; function free(S: String): String; external; function printf(s: String): integer; external; function sprintf(S, format: String; n: integer): String; external; function eprintf(s: String): integer; external;