473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Random Filenames

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
Jul 19 '05 #1
2 2714
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


Jul 19 '05 #2
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?

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Oliver Spiesshofer | last post by:
Hi, how would I make a script that pics a random file from a tree? Is there something like this existing? I need one that can handle many files on a large tree. thanks Oliver
4
by: kingofkolt | last post by:
I have a directory of images, called "random". In it are the following files: 1.gif 2.gif 3.gif 4.gif I use this script to choose a random image and display it:
7
by: Robin Becker | last post by:
We've been queried about the randomness of some filenames we're producing. I worked through and seemed to satisfy myself that random is being initialised from the system time in C time(&now)...
9
by: Michael Burtenshaw | last post by:
I would like to make a slide show using random images. The problem is my host is 250.com, and they don't support cgi-programs. Is there another way to accomplish random images?
2
by: Amy | last post by:
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...
2
by: rbutch | last post by:
guys, i need a little help with this. this is working (well sort of) i get the info, but it's not moving to a new line as it iterates thru the array and all of the fields are like ONE HUGE LONG...
4
by: Scott-ASC | last post by:
I'm looking for some code that will allow me to have a random wav file played every time someone refreshes my home page. I've found some that will allow 5 different wavs (and it wasn't scalable),...
10
by: howa | last post by:
for example, there are 10K files in the directory, given that i don't know if files name, is it possible to fetch a file randomly? thanks.
5
by: Tobi Hammert | last post by:
i just want to show up a random pic. <? $files = glob("./gfx/zufall/*"); shuffle ($files); if (count($files) < 1) $count = count($files); else $count = 1; for ($i = 0; $i < $count; $i ++)
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.