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. PHP用正则批量替换Img中src内容,用正则表达式获取图片路径实现缩略图功能

    PHP用正则批量替换Img中src内容,用正则表达式获取图片路径实现缩略图功能 网上很多正则表达式只能获取或者替换一个img的src内容,或者只能替换固定的字符串,要动态替换多个图片内容的试了几个小时 ...

  2. Makefile 使用总结【转】

    转自:http://www.cnblogs.com/wang_yb/p/3990952.html 1. Makefile 简介 Makefile 是和 make 命令一起配合使用的. 很多大型项目的编 ...

  3. Linux系统中为php添加pcntl扩展的方法

    1.首先看下 phpize命令 所在的目录  (ps:我的目录/usr/bin/phpize)如果没有找到的话 执行安装yum install php53_devel (ps:请注意自己的版本) 安装 ...

  4. Jquery知识

    1.窗口自适应调整 (设置layout的fit属性值为true即可) //窗口自适应调整 $(function() { windowResize(); //文档载入时加载 $(window).resi ...

  5. recycleview中使用checkbox导致的重复选中问题

    参考博文:http://www.myexception.cn/mobile/1852852.html 在使用RecycleView做仿微信图片选择器,其中条目中使用了checkbox,在选中时由于ho ...

  6. Android中的图片压缩

    1.android中计算图片占用堆内存的kB大小跟图片本身的kB大小无关,而是根据图片的尺寸来计算的. 比如一张 480*320大小的图片占用的堆内存大小为: 480*320*4/1024=600kB ...

  7. ACM题目————玩转二叉树

    给定一棵二叉树的中序遍历和前序遍历,请你先将树做个镜面反转,再输出反转后的层序遍历的序列.所谓镜面反转,是指将所有非叶结点的左右孩子对换.这里假设键值都是互不相等的正整数. 输入格式: 输入第一行给出 ...

  8. FIleReader无法解决编码问题

    可把FileReader 用InputStreamReader(new FileInputStream(String fileptah),"utf-8")替代

  9. Java8新特性之一、时间日期API

    package com.effective.common.base.date; import java.time.Instant; import java.time.LocalDate; import ...

  10. dbms_job.submit 单次执行

    DBMS_JOB.SUBMIT用于定时任务,基本用法如下: DBMS_JOB.SUBMIT(:jobno,//job号                                      'yo ...