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. python爬虫学习记录

    爬虫基础 urllib,urllib2,re都是python自带的模块 urllib,urllib2区别是urllib2可以接受一个Request类的实例来设置url请求的headers,即可以模拟浏 ...

  2. python实现指定目录下批量文件的单词计数:串行版本

    直接上代码. 练习目标: 1.  使用 Python 面向对象的方法封装逻辑和表达 : 2.  使用异常处理和日志API : 3.  使用文件目录读写API : 4.  使用 list, map, t ...

  3. 记一个由MemCached引发的性能问题

    最近有个项目用loadrunner做了压力测试,发现并发量还不到200服务器就支撑不住了.boss那边紧急开会,说此项目最近3个月内将有100家中大型公司用于校园招聘工作,如果这个问题不解决公司有可能 ...

  4. 160906、Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)

    互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,Dubbo是一个分布式服务框架,在这种情况下诞生的.现在核心业务抽取出来,作为独立的服务,使 ...

  5. scala偏函数

    package com.ming.test /** * 在Scala中,偏函数是具有类型PartialFunction[-T,+V]的一种函数.T是其接受的函数类型,V是其返回的结果类型. * 偏函数 ...

  6. webpack笔记_(2)_Refusing to install webpack as a dependency of itself

    安装webpack时,出现以下问题: Refusing to install webpack as a dependency of itself npm ERR! Windows_NT npm ERR ...

  7. mybatis n+1问题

    mybatis的一对多或者多对多的时候,2中方式解决,一种是嵌套select,但是会有n+1问题,不推荐:另外一种是使用一条sql,在该sql里面使用子查询的方式来完成.比如 select * fro ...

  8. HDU 1024:Max Sum Plus Plus(DP)

    http://acm.hdu.edu.cn/showproblem.php?pid=1024 Max Sum Plus Plus Problem Description Now I think you ...

  9. Spring集成memcached的详细介绍

    前提条件:工程需要引入jar包java_memcached-release_2.0.1.jar 第一步:添加memcached的配置文件. <bean class="org.sprin ...

  10. 关于iframe嵌套、动态获取iframe内的url、父页面重定向

    1 $(function () { 2 //选择器是选择了easyui中的点击链接,出现新的iframe 3 $("a[target='mainFrame']").click(fu ...