{ renvois True si le nom de fichier est valide }
function IsValidFilename(const FileName : string) : boolean;
var
n : integer;
const
fbd = ['\','/',':','*','?','"','<','>','|'];
begin
for n := 1 to Length(FileName) do
begin
result := not (FileName[N] in fbd);
if not result then
exit;
end;
end;
{ retourne FileName avec tout les caracteres invalides remplacés par underscore "_" }
function SafeValidFilename(const FileName : string) : string;
var
pBOut : ^byte;
const
fbd = [$22,$2a,$2f,$3a,$3c,$3e,$3f,$5c,$7c];
begin
result := filename;
pBOut:= @Result[1];
while pBOut^ <> $0 do
begin
if pBOut^ in fbd then
pBOut^ := $5f;
inc(pBOut);
end;
end;