function getFileName(fileDir : string) : string;
var
fileName : string;
tempNum, i : integer;
tempChar : char;
begin
tempNum := 0;
for I := Length(fileDir) downto 0 do
begin
tempNum := tempNum + 1;
tempChar := fileDir[I-1];
if tempChar = '\' then
break;
end;
Result := RightStr(fileDir, tempNum);
end;
It shows that acces violation is in this line:
tempChar := fileDir[I-1];
What does it mean? And why there is a such a problem?