From moeller@ebi.ac.uk  Fri May 21 10:34:22 1999
Received: from alpha1.ebi.ac.uk (root@alpha1.ebi.ac.uk [193.62.196.122])
	by swi.swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id KAA04733
	for <prolog@swi.psy.uva.nl>; Fri, 21 May 1999 10:34:21 +0200 (MET DST)
Received: from mozart.ebi.ac.uk (mozart.ebi.ac.uk [193.62.196.62])
	by alpha1.ebi.ac.uk (8.8.7/8.8.7) with ESMTP id JAA24950
	for <prolog@swi.psy.uva.nl>; Fri, 21 May 1999 09:34:18 +0100 (BST)
Date: Fri, 21 May 1999 09:34:18 +0100 (BST)
From: Steffen Moeller <moeller@ebi.ac.uk>
To: prolog@swi.psy.uva.nl
Subject: Re: get PID
In-Reply-To: <199905191455.QAA03798@gollem.swi.psy.uva.nl>
Message-ID: <Pine.OSF.4.05.9905210921430.23859-100000@mozart.ebi.ac.uk>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

> > Is there a way to get the PID (process identification number)
> > in SWI prolog, as with the getpid() function in C ?
> > I need to create unique filenames; I considered tmp_file/2,
> > but these files are removed on exit.
> 
> No.  This will do:
> [...great example left out...] 

To remain platform independent you might choose to just add a rather
huge random number instead of choosing the PID, should be more secure
also:

?- X is random(2000000).

X = 464277 ;

No   

and mix it with the time if you like:
?- get_time(X),convert_time(X,Year,Month,Day,Hour,Minute,Second,MilliSeconds).

X = 9.27275e+08
Year = 1999
Month = 5
Day = 21
Hour = 9
Minute = 31
Second = 34
MilliSeconds = 16 ;

No 

Must admit that such long filenames don't really make you platform
independent either :)

Cheers,

Steffen

 --
    Steffen Moeller <moeller@ebi.ac.uk>

