>Hi all,
>Is there any way for a user process to get the actual name of an open
>data base? I'm looking for the fully-qualified MPE filename of the root
>file that was actually opened.
>-- Bruce
There are a couple of ways but they require privileged mode:
1. getprivmode; <<root file's file code is -400>>
fnumber := fopen (DBname,1,,,,,,,,,,,-400);
if fnumber <> 0 then
begin
fgetinfo (fnumber,MPE'file'name);
fclose (fnumber,0,0);
end;
getusermode;
NOTE! There is the danger that someone could issue a file equation:
:file XYZDB;DEL
and the above code would purge the root file.
2. If you only have ONE database in your process then you could cycle
through the list of open files ( 3 >fnum>max'fnum) again in priv mode until
you encounter a file with -400 as the file code.
Regards
Paul H. Christidis
|