Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a unique filename
Message
 
À
02/01/2004 09:49:14
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00863432
Message ID:
00863687
Vues:
8
Michaels suggestion will work but it creates nasty filenames <g>... A couple of things you can do to make that a little cleaener:

Use:
Path.GetTempFileName()
which returns a filename and creates a 0 byte file (which seems lame, but it maps the underlying API call).

You can use Michaels idea and use a Hash on it to make it more managable:
(new Guid()).ToString().GetHashCode().ToString("x");
This will return a hex representation of hte hash that's somewhere around 8 =12 characters long usually.

Actually the Temp API uses something very similar to return filenames.

+++ Rick ---


>Is there a function that will return a unique name? I am looking for something like VFP's SYS(2015) function. I want to generate a unique/random name so I can use it for creating a temporary file used to capture some output.
>
>Thanks,
>
>Jerry
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform