Output of file : STRINGS.SWG contained in archive :
ALLSWAG4.ZIP
SWAGOLX.EXE (c) 1993 GDSOFT ALL RIGHTS RESERVED 00081 STRING HANDLING ROUTINES 1 05-28-9313:58ALL SWAG SUPPORT TEAM Convert ASCIIZ to Turbo IMPORT 6 ^&4Ó Function Asc2Str(Var s; Max : Byte): String;ã{ Converts an ASCIIZ String to a Turbo Pascal String }ã{ With a maximum length of max. }ãVarã StArray : Array[1..255] of Char Absolute s;ã Len : Integer;ãbeginã Len := Pos(#0,StArray)-1; { Get the length }ã if (Len > Max) or (Len < 0) then { length exceeds maximum }ã Len := Max; { so set to maximum }ã Asc2Str := StArray;ã Asc2Str[0] := Chr(Len); { Set length }ãend; { Asc2Str }ã 2 05-28-9313:58ALL SWAG SUPPORT TEAM CLEANSTR.PAS IMPORT 6 ^&t Procedure CleanString(Var s:String);ãbeginã fillChar(s,sizeof(s),0);ãend;ã{ I think that I already posted this form once, but here it is again...ã This is the best way, For what the original poster wanted it for- toã clear out a String to Write to a File. Method #1 above will overfillã any subranged String, yours only clears out the current size of theã String (ie if you had s:String; s := 'a'; then your Procedure wouldã only fill the first Character. The last version merely fills theã entire String no matter what the size of it is.ã-Brian Papeã} 3 05-28-9313:58ALL SWAG SUPPORT TEAM COMMA.PAS IMPORT 17 ^&