C library function - tmpfile()
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()的更多相关文章
- C library function - rewind()
Description The C library function void rewind(FILE *stream) sets the file position to the beginning ...
- C library function - freopen()
Description The C library function FILE *freopen(const char *filename, const char *mode, FILE *strea ...
- Macro definition of snprintf conflicts with Standard Library function declaration
Macro definition of snprintf conflicts with Standard Library function declaration 即将此处的宏定义注释掉,因为在VS2 ...
- [Swift]数学库函数math.h | math.h -- mathematical library function
常用数学函数 1. 三角函数 double sin (double);//正弦 double cos (double);//余弦 double tan (double);//正切 2 .反三角函数 d ...
- python bug the C library strftime function.
import timedef date2mktime(date, format_='%Y-%m-%d'): return int(time.mktime(time.strptime(date, for ...
- [工作积累] Android dynamic library & JNI_OnLoad
Bionic libc doesn't load dependencies for current .so file (diff from Windows or Linux) so a explici ...
- c++学习书籍推荐《Beyond the C++ Standard Library》下载
百度云及其他网盘下载地址:点我 作者简介 Björn Karlsson works as a Senior Software Engineer at ReadSoft, where he spends ...
- systemtap 2.8 news
* What's new in version 2.8, 2015-06-17 - SystemTap has improved support for probing golang programs ...
- 单片机main函数退出后发生什么——以stm32为例
STM32:main函数退出后发生什么? 我们都在说单片机要运行在无限循环里,不能退出,可退出之后会发生什么? 讨论STM32启动过程的文章数不胜数,可main函数结束之后会发生什么却少有讨论. 几日 ...
随机推荐
- 【python cookbook】【数据结构与算法】13.通过公共键对字典列表排序
问题:想根据一个或多个字典中的值来对列表排序 解决方案:利用operator模块中的itemgetter()函数对这类结构进行排序是非常简单的. # Sort a list of a dicts on ...
- Linux安装JDK、MyEclipse、MySql
一.将下载好的 jdk-7u79-linux-x64.tar.gz 复制到要安装的目录 /usr/lib/jdk (注:jdk文件夹自己创建 sudo mkdir jdk)二.进入到目录 /usr/l ...
- ServiceStack.Redis 之 IRedisTypedClient 04_转
IRedisTypedClient IRedisTypedClient类相当于IRedicClient的强类型版,其方法与属性大多数与IRedisClient类似. 它支持在Redis中使用Linq查 ...
- Array JSON
Tool: Online jsonviewer JSON: JavaScript Object Notation. JSON is a syntax for storing and exchangin ...
- Hibernate,get()和load()区别
最主要区别在于,检索策略不同. 无论get和load,首先都会去session缓存中看有没有现成的数据.没有的话,get会采用立即检索策略.即:将对象从数据库检索出来并返回,不使用代理类.load的话 ...
- ACM题目————列变位法解密
这是在百度之星看到的. Problem Description 列变位法是古典密码算法中变位加密的一种方法,具体过程如下 将明文字符分割成个数固定的分组(如5个一组,5即为密钥),按一组一行的次序整齐 ...
- C/C++获取数组的长度
C.C++中没有提供 直接获取数组长度的函数,对于存放字符串的字符数组提供了一个strlen函数获取长度,那么对于其他类型的数组如何获取他们的长度呢?其中一种方法是使 用sizeof(array) / ...
- 手把手教你用C++ 写ACM自动刷题神器(冲入HDU首页)
转载注明原地址:http://blog.csdn.net/nk_test/article/details/49497017 少年,作为苦练ACM,通宵刷题的你 是不是想着有一天能够荣登各大OJ榜首,俯 ...
- Android invalidate() 和 postInvalidate()的区别
Android提供了Invalidate方法实现界面刷新,但是Invalidate不能直接在线程中调用,因为他是违背了单线程模型:Android UI操作并不是线程安全的,并且这些操作必须在UI线程中 ...
- CRB and His Birthday(背包)
CRB and His Birthday Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...