Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Random File Name

Random File Name

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlounge
8 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lxkjlzz
    wrote on last edited by
    #1

    hi: How to generate random file names? It is better provide a simple method. thanks :)

    D A 2 Replies Last reply
    0
    • L lxkjlzz

      hi: How to generate random file names? It is better provide a simple method. thanks :)

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you tried GetTempFileName()?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      L 1 Reply Last reply
      0
      • L lxkjlzz

        hi: How to generate random file names? It is better provide a simple method. thanks :)

        A Offline
        A Offline
        Aric Wang
        wrote on last edited by
        #3

        UINT GetTempFileName( LPCTSTR lpPathName, // pointer to directory name for temporary // file LPCTSTR lpPrefixString, // pointer to filename prefix UINT uUnique, // number used to create temporary filename LPTSTR lpTempFileName // pointer to buffer that receives the new // filename );

        I am not a genius, but shed more sweat!

        L 1 Reply Last reply
        0
        • D David Crow

          Have you tried GetTempFileName()?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          L Offline
          L Offline
          lxkjlzz
          wrote on last edited by
          #4

          I use it,thanks

          1 Reply Last reply
          0
          • A Aric Wang

            UINT GetTempFileName( LPCTSTR lpPathName, // pointer to directory name for temporary // file LPCTSTR lpPrefixString, // pointer to filename prefix UINT uUnique, // number used to create temporary filename LPTSTR lpTempFileName // pointer to buffer that receives the new // filename );

            I am not a genius, but shed more sweat!

            L Offline
            L Offline
            lxkjlzz
            wrote on last edited by
            #5

            Filename extension from .tmp to .txt or another? how to do

            M 1 Reply Last reply
            0
            • L lxkjlzz

              Filename extension from .tmp to .txt or another? how to do

              M Offline
              M Offline
              Madhu Nair 0
              wrote on last edited by
              #6

              Find .tmp and replace it to .txt in the generated filename string ;)

              L 1 Reply Last reply
              0
              • M Madhu Nair 0

                Find .tmp and replace it to .txt in the generated filename string ;)

                L Offline
                L Offline
                lxkjlzz
                wrote on last edited by
                #7

                May I get filename which like *.txt directly using GetTempFileName() :)

                D 1 Reply Last reply
                0
                • L lxkjlzz

                  May I get filename which like *.txt directly using GetTempFileName() :)

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  Did you read the docs? It plainly states that a .tmp extension will be used.

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups