+ Reply to Thread
Results 1 to 3 of 3

Thread: How to create a temporary file?

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    43

    How to create a temporary file?

    How to create a temporary file?

    I want to create a temporary file. How can I do this?

    Please remember that file name should be unique.

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    37
    You can use GetTempFileName API for this purpose.

    Example:

    Code:
    CString GetMyTempFileName()
    {
    	CString strTempFileName ;
    	
    	TCHAR szTempDirectory[MAX_PATH] ;
        GetTempPath(MAX_PATH, szTempDirectory) ;
    
    	TCHAR szTempFileName[MAX_PATH] ;
        GetTempFileName(szTempDirectory, "MyTempFile", 0, szTempFileName) ;
    
    	strTempFileName = szTempFileName ;
    
    	return szTempFileName ;
    }
    Hope this helps.

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    43
    That did my job.

    Thanks man.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts