Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unique file names
Message
De
10/09/1998 12:44:45
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00135083
Message ID:
00135128
Vues:
10
>>>With VFP and Win9x or NT you could drop the substr part (and think dropping is really better) and even add a one-two char station identifier to make it always unique.
*table stations exist
>>>* structure just (online l)
>>>* prg entry
>>>use stations
>>>do while !(seek(.f.,"stations","online") and rlock("stations"))
>>>  insert into stations values (.f.)
>>>enddo
>>>
>>>* cUniqFile = "T"+padl(recno("stations"),3,"0")+sys(2015)+".tmp"
Cetin
>>Ooops. Extra careless code:
replace online with .t.
>>*after enddo
>>*at exit of app
>>replace online with .f. in "stations"
>>unlock in "stations"
>Hi Cetin,
>
>Only one problem with this. It assumes that the drive supports long filenames, which may or may not be the case depending on the OS. For example, I don't believe that Netware 3.1x has long filename support. This may have been the reason that 6.0 suggests the SUBSTR() business.
Hidy George,
You're right. I don't think of those details anymore with a few assumptions (assumptions always mean to fail :( ) :
-No one uses VFP w/o a local disk and w/o win95 or NT (V5 partly guarantees it)
-If 1st assumption succeeded I would never create temp files on a remote drive
Seem I force my clients to more than M$ :( The real failure part would be in do while loop I think. Having no delay there and in any case few stations hit the same login time, then except first, rest could wait forever. Quick code always have some problems :( In fact I use substr (stuff) but always precede it with a letter.
cFileName = stuff("T"+sys(2015),9,0,".")
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform