What are the temporary disk files?How to create them?

What are the temporary disk files?How to create them?

All most large programs with large with large data objects do not even try to save all their data
in memory.they only read the data,index the data,and than than write the file in Temporary disk files.  
  Some rules of creating files are given below:
1.The file name must be unique. This uniqueness can be guaranteed by using tmpfile() or tmpnam().
2.The file must be deleted when you have finished using it. If you create the file using tmpfile(), the operating system deletes the file for you. If you create it with tmpnam() and an explicit open, your program must delete the file.

Syntax of creating files are given below:
FILE *TempFile = tmpfile();
     // Lines of code to use the file 
fclose(TempFile);

By:Vivek Kr. Agarwal
Date:2008-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Subjective Links

C Subjective interview questions and answers for experienced and fresher