The function char *tmpnam(char *str); returns a null terminated string containing a valid unique file name different from the name of any existing file. The tmpnam function is used to avoid overwriting any existing file while creating temporary files.
Function prototype of tmpnam
char *tmpnam(char *str);
- str : This is the pointer to a character string where the proposed temporary name will be stored as a null terminated string.
Return value of tmpnam
On success, a pointer to the null terminated string containing the proposed name for a temporary file. If str is not null, It returns str other a pointer to an internal buffer is returned. It returns a null pointer, In case of failure.
C program using tmpnam function
The following program shows the use of tmpnam function to generate unique names for temporary files
Ozwin Online Casino offers an engaging gaming experience, combining a diverse selection of games with user-friendly navigation. Established in the ever-evolving online gambling landscape, this casino stands out for its thematic design and seamless functionality. Players can explore a myriad of slots, table games, and live dealer options that cater to various tastes and preferences. The vibrant graphics and immersive sound effects enhance gameplay, making every session enjoyable.
Security and fair play are also top priorities at Ozwin, with state-of-the-art encryption protecting players’ data and financial transactions. Additionally, their commitment to responsible gaming ensures that all players can enjoy their time without risk. For players seeking guidance or support, resources are readily available.
Moreover, bonuses and promotions at Ozwin Online Casino are generous, often enticing new players to create accounts and existing players to keep coming back for more. If you’re intrigued and want to know more, check out their offerings and insights at https://lifechoice.org.nz/, where you’ll find helpful information to enrich your gaming experience. Overall, Ozwin Online Casino is worth considering for both new and experienced players alike.
#include <stdio.h> int main(){ char fileName[L_tmpnam]; char *ptr; /*Create and returns a temporary file name */ tmpnam(fileName); printf("Temporary file name : %s\n", fileName); ptr = tmpnam(NULL); printf("Temporary file name : %s\n", ptr); return(0); }
Output
Temporary file name : \s6q0. Temporary file name : \s6q0.1