Useful pascal code Flashcards
1
Q
saving a file
A
procedure SaveAsText(Board: TBoard; WhoseTurn: Char; fileName: string);
var savefile: textfile; FileNo, RankNo: Integer; begin assignfile(savefile, fileName); rewrite(savefile); Writeln(savefile, WhoseTurn); For RankNo := 1 To BoardDimension Do begin for FileNo := 1 to BoardDimension do Writeln(savefile, Board[RankNo, FileNo]); end; closefile(savefile); end;