Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a unique filename
Message
 
To
02/01/2004 09:49:14
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00863432
Message ID:
00863687
Views:
10
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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform