Description

The C library function FILE *tmpfile(void) creates a temporary file in binary update mode (wb+). The temporary file created is automatically deleted when the stream is closed (fclose) or when the program terminates.

Declaration

Following is the declaration for tmpfile() function.

FILE *tmpfile(void)

Parameters

  • NA

Return Value

If successful, the function returns a stream pointer to the temporary file created. If the file cannot be created, then NULL is returned.

Example

The following example shows the usage of tmpfile() function.

#include <stdio.h>

int main ()

{

FILE *fp;

fp = tmpfile();

printf("Temporary file created\n");

/* you can use tmp file here */

fclose(fp);

return(0);

}

Let us compile and run the above program to create a temporary file in /tmp folder but once your program is out, it will be deleted automatically and the program will produce the following result −

Temporary file created

C library function - tmpfile()的更多相关文章

  1. C library function - rewind()

    Description The C library function void rewind(FILE *stream) sets the file position to the beginning ...

  2. C library function - freopen()

    Description The C library function FILE *freopen(const char *filename, const char *mode, FILE *strea ...

  3. Macro definition of snprintf conflicts with Standard Library function declaration

    Macro definition of snprintf conflicts with Standard Library function declaration 即将此处的宏定义注释掉,因为在VS2 ...

  4. [Swift]数学库函数math.h | math.h -- mathematical library function

    常用数学函数 1. 三角函数 double sin (double);//正弦 double cos (double);//余弦 double tan (double);//正切 2 .反三角函数 d ...

  5. python bug the C library strftime function.

    import timedef date2mktime(date, format_='%Y-%m-%d'): return int(time.mktime(time.strptime(date, for ...

  6. [工作积累] Android dynamic library & JNI_OnLoad

    Bionic libc doesn't load dependencies for current .so file (diff from Windows or Linux) so a explici ...

  7. c++学习书籍推荐《Beyond the C++ Standard Library》下载

    百度云及其他网盘下载地址:点我 作者简介 Björn Karlsson works as a Senior Software Engineer at ReadSoft, where he spends ...

  8. systemtap 2.8 news

    * What's new in version 2.8, 2015-06-17 - SystemTap has improved support for probing golang programs ...

  9. 单片机main函数退出后发生什么——以stm32为例

    STM32:main函数退出后发生什么? 我们都在说单片机要运行在无限循环里,不能退出,可退出之后会发生什么? 讨论STM32启动过程的文章数不胜数,可main函数结束之后会发生什么却少有讨论. 几日 ...

随机推荐

  1. innodb的锁到底占用多少内存

    举个简单的例子: CREATE TABLE `sample` ( `i` ) unsigned NOT NULL auto_increment, `j` ) default NULL, PRIMARY ...

  2. 内存映射MMAP和DMA【转】

    转自:http://blog.csdn.net/zhoudengqing/article/details/41654293 版权声明:本文为博主原创文章,未经博主允许不得转载. 这一章介绍Linux内 ...

  3. linux中的优先搜索树的实现--prio_tree【转】

    转自:http://blog.csdn.net/bailyzheng/article/details/8041943 linux中的优先搜索树的实现--prio_tree prio_tree在linu ...

  4. awr报告生成方法

    以上是在linux的oracle的命令截图. 如果是在unix的命令,则需要在命令前面加上\符号,变成了\@$ORACLE_HOME/rdbms/admin/awrrpt.sql

  5. Temporary InMemory Tables [AX 2012]

    Temporary InMemory Tables [AX 2012] This topic has not yet been rated - Rate this topic Updated: Oct ...

  6. 为博客启用MetaWeBlog API

    最近想写一个博客系统,主要有以下几点功能. 能够使用Live Writer来发布.修改文章 使用MongoDB作为持久化 对于博客中的图片.CSS.JS文件,使用CDN加速 后期可加上Radis 使用 ...

  7. Microsoft Office 2013 Product Key

    Microsoft Office 2013 Product Key ( Professional Plus ) PGD67-JN23K-JGVWW-KTHP4-GXR9G B9GN2-DXXQC-9D ...

  8. 在Ecshop后台打印订单页面将商品按货号排序

    ECSHOP后台管理里的“打印订单" 页面里的商品排序有点乱,现在想改成按序号来排序,修改方法如下 下面是在2.7.2基础上做的修改 打开 admin/order.php  文件 找到(大约 ...

  9. 文件输出debug

    file_put_contents('/tmp/heat.log', var_export($mainArr, true),FILE_APPEND);

  10. 20150604_Andriod 窗体PopupWindow

    package com.example.test1; import android.support.v7.app.ActionBarActivity;import android.os.Bundle; ...