[fpc-pascal]Temporary file names under GO32
Aitor Santamaria Merino
aitor.sm at wanadoo.es
Mon Nov 26 00:11:14 CET 2001
Ok, as I started the thread, here we go with a home-made one. It
produces dull names formed by letters (not neccessarily filenames),
which are unique UP TO a second of difference... I would have to modify
it, as if one needed to produce several TEMP files at once, it would be
a problem:
FUNCTION GetTempName: string;
type
a4 = array[1..4] of byte;
var
dw,s100: word;
td : datetime;
pack : longint;
name : string;
i : byte;
begin
getdate (td.year,td.month,td.day,dw);
gettime (td.hour,td.min,td.sec,s100);
packtime (td, pack);
name := '';
for i:=1 to 8 do
if (i mod 8)=1
then name := name + chr (ord('A')+ (a4(pack)[((i-1) div 2)
+1] and 15))
else name := name + chr (ord('A')+ (a4(pack)[((i-1) div 2)
+1] >> 4));
GetTempName := name
end;
WAIT, WAIT!! it compiles and seems to work??? ONE QUESTION: if you look
carefully, you'll see that a C operator has slipped in (sorry): >>
Does it mean that this operator is accepted in FPK as well? Anyway, I
will change it to SHR...
Aitor
Ralf A. Quint wrote:
> At 12:34 PM 11/25/2001, you wrote:
>
>> Hola,
>>
>> >Has anyone ever written a function to get a temporary unique file name?
>>
>> In Windows there're GetTempFileName and GetTempFileName32.
>>
>> For Linux, a hint: I heard that Borland had used somebody else's
>> algorithm to implement GUIDs. Implementation could be in FreeCLX.
>
> Well, Nico, that all doesn't help Aitor at all, as you can see in the
> subject, he is asking for a solution for the GO32 version of the
> compiler, so neither your hint for Windows or Linux apply here..... :-(((
>
> Ralf
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
More information about the fpc-pascal
mailing list