Hi all,
I was wondering if there is a cross-platform method of generating a temporary filename, one that would work with Delphi AND freepascal (whatever platform)?
I currently have tried coding this (not run it yet though):
[pascal]Function TPackFile.GetTemporaryFileName : AnsiString;
Const
cValidChars = 'abcdefghijklmnopqrztuvwxyz1234567890!@#$%()_+[ ;]{}';
cValidCharsLen = Length(cValidChars);
Var
i : Integer;
Seed : LongInt;
Begin
Seed := RandSeed;
Randomize;
SetLength(Result,Random(20) + 10);
For i := 1 To Length(Result) Do Result[i] := cValidChars[Random(cValidCharsLen) + 1];
RandSeed := Seed;
End;[/pascal]
Does this code seem ok to generate random filenames?
cheers,
paul
Bookmarks