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)串口的操作, ...
随机推荐
- 突破极限 解决大硬盘上安装Sco Unix新思路
突破极限 解决大硬盘上安装Sco Unix新思路 [url]http://os.51cto.com/art/200809/89750.htm[/url] 硬盘越做越大,然我喜欢让我忧.10 ...
- TwinCAT 3中基于UDP协议通讯的C++实现
因为项目需要,学习了TwinCAT3中使用UDP协议进行通讯的基本知识.这个做个简单的笔记,方便以后查询. 1 概述 倍福为了实现从实时环境中直接访问网卡(network cards)专门提供了一个函 ...
- Beautiful Number
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2829 Beautiful Number Time Limit: 2 Sec ...
- ASP.NET通过JavaScript实现Button 的Enabled=false
正常代码控制无法满足需求,所以记录一下方法: <input id="Button5" onclick=" CX()" type="button& ...
- 可靠的UDP连接 & MTU MSS
这个网页里面写了: http://blog.csdn.net/plusboy/article/details/1523308 其可靠性必须由上层应用实现.一般都会采用消息重传来实现其可靠性,采用消息重 ...
- 【POJ 2482】 Stars in Your Window(线段树+离散化+扫描线)
[POJ 2482] Stars in Your Window(线段树+离散化+扫描线) Time Limit: 1000MS Memory Limit: 65536K Total Submiss ...
- 怎样通过MSG_WAITALL设置阻塞时间,IO模式精细讲解: MSG_DONTWAIT 、 MSG_WAITALL
首先给出MSDN上一段设置阻塞超时的代码:(网址为http://social.msdn.microsoft.com/Forums/zh-SG/visualcpluszhchs/thread/3d9da ...
- private SortedDictionary<string, object> Dic_values = new SortedDictionary<string, object>();
private SortedDictionary<string, object> Dic_values = new SortedDictionary<string, object&g ...
- Kinect 开发 —— 图片浏览
总体思路 首先运用WPF编写一个简单的支持多点触控的图片浏览程序,这方面您可以参看MSDN上的这篇文章,上面有代码,可能需要FQ才能下载.中文的话,您可以参考Gnie同学关于在WPF上面多点触屏(Mu ...
- ajax关于主流中的异类:应对Opera(四)
修改示例以支持Opera <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> ...