Without SetLength(var,0) at the end I get Runtime Error 216 once, adding those - assuming FPC now required me to zero out those fields, I now get the error twice.
Code: Program MakePrompts; Type Language_File = Record Description:Array of Char; {null terminated string} Enabled:Boolean; SecurityLevel:Byte; {zero to 255, 255 is reserved for SYSOP} Flags:Longint; {32 Flags - A..Z,1..6} MenuPath:Array of Char; TextPath:Array of Char; QuestPath:Array of Char; End; Var L:Language_File; Procedure Make_Language_File( Description,MenuPath,TextPath,QuestPath:String; Enabled:Boolean;SecurityLevel:Byte;Flags:Longint); Var FileSize:Longint; Begin Writeln('Language_File empty size is ',SizeOf(L)); FileSize:=0; Description:=Description+#0; Inc(FileSize,Length(Description)); MenuPath:=MenuPath+#0; Inc(FileSize,Length(MenuPath)); TextPath:=TextPath+#0; Inc(FileSize,Length(TextPath)); QuestPath:=QuestPath+#0; Inc(FileSize,Length(QuestPath)); SetLength(L.Description,Length(Description)); SetLength(L.MenuPath,Length(MenuPath)); SetLength(L.TextPath,Length(TextPath)); SetLength(L.QuestPath,Length(QuestPath)); Move(Description[1],L.Description,Length(Description)); Move(MenuPath[1],L.MenuPath,Length(MenuPath)); Move(TextPath[1],L.TextPath,Length(TextPath)); Move(QuestPath[1],L.QuestPath,Length(QuestPath)); L.Enabled:=Enabled; L.SecurityLevel:=SecurityLevel; L.Flags:=Flags; Inc(FileSize,6); Writeln('Language_File size is ',FileSize); SetLength(L.Description,0); SetLength(L.MenuPath,0); SetLength(L.TextPath,0); SetLength(L.QuestPath,0); End; Begin Make_Language_File('English (c) 2022 by Ozz Nixon','%ROOTPATH%\MENUS\','%ROOTPATH%\TXTFILES\','%ROOTPATH%\QUESTION\',True,0,0); End.
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel