Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RAND() not very random
Message
De
21/09/2006 11:45:26
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
21/09/2006 06:09:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01155607
Message ID:
01156037
Vues:
35
>>>>How so, amd why not suggest an alternative? It's just a cheap & cheerful way of generating a (fairly) unigue file name.
>>>
>>>
>>>lcDateStr = ttoc(datetime(), 1)
>>>
>>
>>Thanks Gregory. Then it needs converting to a format readable to a British eye/brain, with "_" separators, etc. It's not that important :-)
>>
>>Terry
>
>Terry,
>
>That's easy
>
>?transform(ttoc(datetime(),1), '@R ####_##_##_##:##:##')
>?transform(ttoc(datetime(),1), '@R ####-##-##_##:##:##')
>
For cases where I just need a sufficiently unique name (which doesn't have to mean anything), I use this function:
Procedure n2s
Lparameters tNR
Local nMod, numdat, sl, trnn2s
trnn2s = "ABCDEFGHIJK123456789LMNOP0QRSTUVWXYZ"
nMod=Len(trnn2s)
numdat=tNR
sl=""
Do While numdat>0
	ns=numdat%nMod
	sl=Substr(trnn2s,ns+1,1)+sl
	numdat=Int(numdat/nMod)
Enddo
Retu sl
Endproc
There's actually a version with fixed length of the resulting string, and trnn2s is a property of the class, and the string itself is not as it looks here, but that's the general idea.

Then my filename is
lcFile=forceext(lcFile+"_"+n2s(int(seconds())), "ext")

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform