Я делаю программу в Delphi, и я пытаюсь настроить игру с помощью «файла сохранения». Я делаю это в Delphi, а не когда приношу код домой. Я просто использую компилятор pascal и не могу запустить свою программу, так как получаю следующие ошибки.
Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling control.p
control.p(44,12) Error: Identifier not found "CloseFile"
control.p(116,14) Error: Identifier not found "closeFile"
control.p(127,13) Error: Identifier not found "assignFile"
control.p(143,4) Fatal: There were 3 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)
Извините, если это глупый вопрос, но я новичок в файлах, и я действительно хочу, чтобы это работало. Ниже приведен весь мой текущий код на всякий случай, если он вам понадобится, извините, если он запутал его черновик, и спасибо за помощь.
program Task3;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
Type
gameRec = record
name: string[30];
skill: integer;
str: integer;
modif: integer;
sskill: string[3];
sstr: string[3];
smodif: string[3];
sf: integer;
ssf : string[1];
end;
var
gameFile : file of gameRec;
p1, p2 : gameRec;
procedure showStats;
begin
FileMode := fmOpenRead;
Reset(gameFile);
read(gameFile, p1);
read(gameFile, p2);
writeln;
writeln(p1.name, '''s stats');
writeln('Skill: ', p1.skill);
writeln('Strenght: ', p1.str);
writeln('Modifier: ', p1.modif);
writeln;
writeln(p2.name, '''s stats');
writeln('Skill: ', p2.skill);
writeln('Strenght: ', p2.str);
writeln('Modifier: ', p2.modif);
writeln;
CloseFile(gameFile);
end;
procedure resetsf;
var
ran12, ran4, namelen: integer;
namepass: boolean;
name: string;
begin
writeln('No save file detected, generating new stats');
namelen := 0;
namepass := false;
repeat
write('What is player 1''s name: ');
readln(name);
namelen := length(name);
if (namelen > 2) and (namelen < 30) then
begin
p1.name := name;
namepass := true;
end
else
writeln('You name must be between 3 and 30 characters');
until namepass = true;
namepass := false;
repeat
write('What is player 2''s name: ');
readln(name);
namelen := length(name);
if (namelen > 2) and (namelen < 30) then
begin
p2.name := name;
namepass := true;
end
else
writeln('You name must be between 3 and 30 characters');
until namepass = true;
ran12 := random(12) + 1;
ran4 := random(4) + 1;
p1.skill := 10 + (ran12 div ran4);
ran12 := random(12) + 1;
ran4 := random(4) + 1;
p1.str := 10 + (ran12 div ran4);
ran12 := random(12) + 1;
ran4 := random(4) + 1;
p2.skill := 10 + (ran12 div ran4);
ran12 := random(12) + 1;
ran4 := random(4) + 1;
p2.str := 10 + (ran12 div ran4);
reWrite(gameFile);
p1.sskill := inttostr(p1.skill); //debug
p1.sstr := inttostr(p1.str);
p1.smodif := inttostr(p1.modif);
//write(gameFile,p1);
p2.sskill := inttostr(p2.skill);
p2.sstr := inttostr(p2.str);
p2.smodif := inttostr(p2.modif); //debug
write(gameFile,p2);
p1.sf := 1;
p1.ssf := inttostr(p1.sf);
write(gameFile,p1); //debug
closeFile(gameFile);
FileMode := fmOpenRead;
Reset(gameFile);
read(gameFile, p1);
read(gameFile, p2);
end;
begin
assignFile(gameFile, 'N:\gamerec.dat');
randomize;
writeln('Game :)');
writeln('By Sam Collins');
writeln;
FileMode := fmOpenRead;
Reset(gameFile);
read(gameFile, p1);
writeln(p1.sf);
if p1.sf = 0 then
resetsf
else
writeln('Save file detected using old stats');
showStats;
readln;
end.
close(gameFile)
, а также для назначения этоassign(gameFile)
Не могу увидеть полную информацию о коде ошибки 217, чтобы дать вам более подробное решение. - person sir psycho sexy   schedule 25.10.2014