This blog is under construction

Friday, 6 April 2012

tmpnam example in C

Header file:
     stdio.h

Synopsis:
     char *tmpnam(char *s);

Description:
     Creates a temporary file name.  Returns unique temporary file name on success, NULL on failure.


tmpnam function C example:


  #include<stdio.h>
  int main() {
        char name[100], *str;
        str = tmpnam(name);
        printf("File name: %s\n", str);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/$ ./a.out
  File name: /tmp/fileBanm2A


No comments:

Post a Comment