C Function mktemp

Source: Internet
Author: User

/** Dlut_mktemp.c ** Created on: July 15, January 8, 2014 * Author: DLUTBruceZhang */# include <stdio. h> # include <string. h> # include <stdlib. h> # include <unistd. h> void dlut_mktemp (char *); int main (int argc, char ** argv, char ** environ) {dlut_mktemp ("test. XXXXXX "); return 0;} void dlut_mktemp (char * template) {char name [1024]; char file_name [1024]; int I = 0; memset (name, 0, sizeof (name); memset (file_name, 0, sizeof (file_n Ame); strcpy (name, template); for (I = 0; I! = 10; I ++) {strcpy (file_name, mktemp (name); printf ("% s \ n", file_name); memset (file_name, 0, sizeof (file_name); strcpy (name, template); unlink (file_name);} return ;}

The running result is as follows:

test.vJFk9Ztest.8vGM35test.lHReYbtest.gX9GShtest.Foz9Mntest.sm6BHttest.DOK4Bztest.EDVywFtest.bde3qLtest.E4DxlR


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.