109.vprintf vfprintf vscanf vfscanf
- vprintf
//输出到屏幕
int POUT(char *str, ...)
{
va_list arg_p=NULL;
//读取
va_start(arg_p, str);
//接受可变参数
int n = vprintf(str,arg_p);
va_end(arg_p);
return n;
} //测试函数
void main()
{
POUTX("%s %d %d %s", "", ,,"");
getchar();
}- vfprintf
//输出到文件
int POUTX(char *str, ...)
{
va_list arg_p = NULL;
//读取
va_start(arg_p, str);
//接受可变参数在一个文件,保存参数不确定,类型不确定的情况
int n = vfprintf(stdout,str, arg_p);
va_end(arg_p);
return n;
} - vscanf
//从屏幕接收数据
int PIN(char *str,...)
{ va_list arg_p = NULL;
va_start(arg_p, str);//读取
int n =vscanf(str, arg_p);//接受可变参数
va_end(arg_p);
return n;
} - vfscanf
//从文件接收数据
int PINX(char *str, ...)
{ va_list arg_p = NULL;
va_start(arg_p, str);//读取
int n = vfscanf(stdin,str, arg_p);//接受可变参数
va_end(arg_p);
return n;
}//测试函数
void main()
{
char str[];
int n;
PINX("%s%d", str, &n);
printf("str=%s,n=%d", str, n);
system("pause");
}
109.vprintf vfprintf vscanf vfscanf的更多相关文章
- printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - 输出格式转换
总览 (SYNOPSIS) #include <stdio.h> int printf(const char *format, ...); int fprintf(FILE *stream ...
- printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - 输出格式转换函数
参考:http://blog.sina.com.cn/s/blog_674b5aae0100prv3.html 总览 (SYNOPSIS) #include <stdio.h> int p ...
- 5.24 Declaring Attributes of Functions【转】
转自:https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html 5.24 Declaring Attributes o ...
- 进程操作篇atexit execl exit fprintf fscanf getpid nice get priority printf setpid system vfork wait waitpid
atexit(设置程序正常结束前调用的函数) 相关函数 _exit,exit,on_exit 表头文件 #include<stdlib.h> 定义函数 int atexit (void ( ...
- C 语言函数手册:涵盖字符测试、字符串操作、内存管理、时间换算、数学计算、文件操作、进程管理、文件权限控制、信号处理、接口处理、环境变量、终端控制
1. 字符测试函数 函数 说明 isascii() 判断字符是否为ASCII码字符 2. 字符串操作 函数 说明 gcvt() 将浮点型数转换为字符串(四舍五入) index() 查找字符串并返回首次 ...
- Linux系统函数read()/write()/pread()/pwrite()的区别-(转自CSDN网络)
在Linux和UNIX中有很多的输入输出函数,有时真是让想跟它攀点关系的菜鸟们束手无策.先来看看都有哪些函数,通过解析与总结,看看能不能让大家能这些函数有个理性的认识,哦,原来是这么回事,也就算我没白 ...
- 标准C函数库的使用方法
本篇介绍若干经常使用的标准C函数的使用方法,主要介绍stdio(标准输入输出).math(数字函数库).time(时间函数库).stdlib(标准函数库)string(标准字符串函数)等. 最后更新 ...
- C语言标准库函数(网络上copy的)
C语言标准库函数 标准io函数Standard C I/Oclearerr() clears errorsfclose() close a filefeof() true if at the end- ...
- 嵌入式文件I/O操作
今天把这块的东西算是看完了.总结一下,(1)这里包括底层文件的I/O操作,实际上是系统调用函数借口,是基于文件描述符的文件操作:(2)还有标准I/O操作,是基于缓冲流的文件操作:还有(3)串口的操作, ...
随机推荐
- 关于viewport详解
- HDU 3374 String Proble
String Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- How Blink works
How Blink works Author: haraken@ Last update: 2018 Aug 14 Status: PUBLIC Working on Blink is not eas ...
- UDP广播
客户端UDP发送消息至服务器端服务器IP:192.168.1.114服务器端口:2014 客户端 Socket socket = new Socket(AddressFamily.InterNetwo ...
- python之路:发附带文件的邮件
发邮件的思路(借用第三方服务): 1.模拟服务器,其中有:服务器地址,发送者地址.发送者的密码 2.创建一个带附件的实例:1.创建一个massage 2.massage包括发送者的地址.接受者的地址. ...
- DSP开发中遇到的问题 - 类指针未初始化后果
收到RECEIVE_REQ_MSG消息时会运行以下的代码,这里由于某种原因m_receiverSlaverController的值仍为NULL,并没有指向详细的CReceiverSlaverContr ...
- Raid阵列之简单介绍
1.raid分类 软raid:用软件模拟raid芯片 硬raid:集成的后来添加的 2.raid基本简介 (1)raid是由廉价磁盘冗余阵列发展成为独立磁盘冗余阵列 (2)linux是借助MD(Mui ...
- 怎么成为合格的WEB前端开发工程师
web前端开发工程师目前来讲是一个热门职位,但是要成为一个合格的web前端开发工程师,需要掌握的知识可不少,零度就简单的为大家讲讲. 大致的来讲,web前端开发工程师需要掌握的知识有:HTML.CSS ...
- 73,QT指针数组实战(指针数组与数组指针)
//指针数组,每一个指针都是一个MainWindow // MainWindow *w[3][4]; // for(int i=0;i<3;i++) // { // for(int j=0;j& ...
- Postman APP
http://chromecj.com/web-development/2017-12/870.html Postman 工具模拟http各种协议请求.