Random Filenames

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Amy

    #1

    Random Filenames

    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


  • Arran Pearce

    #2
    Re: Random Filenames

    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_SPA M_claritycon.co m> wrote in message
    news:eYfaZWQRDH A.1324@TK2MSFTN GP11.phx.gbl...[color=blue]
    > Amy, you could use a TempFileCollect ion 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" <amyl@paxemail. com> wrote in message
    > news:ukmN71ORDH A.2676@TK2MSFTN GP10.phx.gbl...[color=green]
    > > 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[/color][/color]
    point[color=blue]
    > a[color=green]
    > > good portion of the elements will not be used anymore until the end of[/color][/color]
    the[color=blue][color=green]
    > > program. In order to conserve memory I wanted to write out the current[/color]
    > data[color=green]
    > > in the hash table to a file.
    > >
    > > Any thoughts?
    > > Amy
    > >
    > >[/color]
    >
    >[/color]


    Comment

    • Simon Bayling

      #3
      Re: Random Filenames

      You could try Path.GetTempFil eName() 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/frlrfsystemiopa thclassgettempf ilenametopic.as p

      Cheers,
      Simon.
      [color=blue]
      > Does anyone know if thier is anything built in the framework to
      > generate random filenames?[/color]


      Comment

      Working...