By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,668 Members | 1,316 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,668 IT Pros & Developers. It's quick & easy.

Random Filenames

P: n/a
Amy
Does anyone know if thier is anything built in the framework to generate
random filenames?

I have a dataset(hash table) that grows very large. After a certain point a
good portion of the elements will not be used anymore until the end of the
program. In order to conserve memory I wanted to write out the current data
in the hash table to a file.

Any thoughts?
Amy
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Probably not the best way but in one application i did a while ago i
generated a GUID and used that & the current date/time as a file name.

"Greg Ewing [MVP]" <gewing@_NO_SPAM_claritycon.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
Amy, you could use a TempFileCollection to create files whose names are
'random'. You could also use the GetTempFileName method off of the Path
class in System.IO. A third option would be to wrap the win32 API
GetTempFileName(). Hope that gives you some ideas to do what you want.

--
Greg Ewing [MVP]
http://www.claritycon.com/

"Amy" <am**@paxemail.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
Does anyone know if thier is anything built in the framework to generate
random filenames?

I have a dataset(hash table) that grows very large. After a certain point
a
good portion of the elements will not be used anymore until the end of

the program. In order to conserve memory I wanted to write out the current

data
in the hash table to a file.

Any thoughts?
Amy


Nov 13 '05 #2

P: n/a
Thanks!
Greetings, timtos.

"Artur Zakrzewski" <Ar*************@hotmail.com> wrote in message
news:#c**************@TK2MSFTNGP10.phx.gbl...
Use System.Guid.NewGuid() method to get a new GUID object.

Regards,

Artur

Użytkownik "timtos" <ha*****@uni-koblenz.de> napisał w wiadomo¶ci
news:be**********@news.uni-koblenz.de...
How did you generate a GUID? I am using DateTime.Now.Ticks as my "GUID" in
one of my applications. Ok for me but not very good :)
Greetings, timtos.

"Arran Pearce" <ar**********@bacoll.ac.uk> wrote in message
news:eH**************@TK2MSFTNGP10.phx.gbl...
Probably not the best way but in one application i did a while ago i
generated a GUID and used that & the current date/time as a file name.

"Greg Ewing [MVP]" <gewing@_NO_SPAM_claritycon.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
> Amy, you could use a TempFileCollection to create files whose names
are > 'random'. You could also use the GetTempFileName method off of the Path > class in System.IO. A third option would be to wrap the win32 API
> GetTempFileName(). Hope that gives you some ideas to do what you want. >
> --
> Greg Ewing [MVP]
> http://www.claritycon.com/
>
>
>
> "Amy" <am**@paxemail.com> wrote in message
> news:uk**************@TK2MSFTNGP10.phx.gbl...
> > Does anyone know if thier is anything built in the framework to

generate
> > random filenames?
> >
> > I have a dataset(hash table) that grows very large. After a certain point
> a
> > good portion of the elements will not be used anymore until the
end of the
> > program. In order to conserve memory I wanted to write out the

current
> data
> > in the hash table to a file.
> >
> > Any thoughts?
> > Amy
> >
> >
>
>



Nov 13 '05 #3

P: n/a
You could try Path.GetTempFileName() under System.IO

"Returns a unique temporary file name and creates a zero-byte file by that
name on disk."

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemiopathclassgettempfilenametopic.asp

Cheers,
Simon.
Does anyone know if thier is anything built in the framework to
generate random filenames?

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.