当前位置:网站首页>C语言标准输入输出(11)
C语言标准输入输出(11)
2022-08-07 13:47:00 【51CTO】
C语言输入输出:指C程序从键盘、文件等外部获取数据,将数据输出到显示器、文件等外部输出设备中。
C语言通过标准库<stdio.h>输入输出函数提供各种输入输出功能;
输入输出简单分为标准输入输出、文件输入输出、字符串格式化输入输出函数(后两种单独介绍)。
标准输入:指从键盘输入;
标准输出:指输出到显示器。
C语言提供标准输入指针stdin、标准输出指针stdout和标准错误输出指针stderr。
标准输入输出本质上也是一种文件输入输出,只不过文件输入输出的FILE类型指针需要我们自己创建,标准输入输出的FILE型指针stdin,stdout,stderr是内置提供的。
注:stdin,stdout,stderr本质是内置的FILE类型指针,只不过操作的是键盘和显示器,C语言将一切设备也认为是文件,因此键盘和显示器是一种设备文件。
标准输入输出主要通过scanf和printf函数实现;
scanf和printf需要提供格式控制字符串,控制输入输出的数据类型和格式。
例如:以下是各种类型的输出输出代码段模板。
1.通用的标准输入输出函数:
2.字符的标准输入输出函数
3.字符串的标准输入输出函数
---------- End ----------
边栏推荐
- 7.cuBLAS开发指南中文版--cuBLAS中的cublasSetVector()和cublasGetVector()
- Rust is one of the common problems: Blocking waiting for file lock on package cache
- LeetCode high-frequency question: longest common subsequence, playing game A and game B, how many prizes can the two brothers get by adding up
- 解决Postman发送Post请求被识别成Get请求
- 使用OpenCV测量图像中物体的大小
- 若依集成just-auth实现第三方授权登录
- change of mind
- LeetCode_6141_合并相似的物品
- Realize database addition, deletion, modification and query in one page
- postgresql逻辑备份工具pg_dump和pg_resotre学习
猜你喜欢

CSO面对面|对话迷你世界,畅谈游戏行业的安全建设

Yolo v5 masks monitoring

SQL教程之 掌握 SQL GROUP BY 的 5 个实用 SQL 示例(含完整sql与测试数据)

Weekend resumption, masters do not sell products but tell stories!

Installation and usage example of target detection toolbox MMDetection

vscode create shortcut key template

Realize database addition, deletion, modification and query in one page

2022年危险化学品生产单位安全生产管理人员考试题模拟考试题库及答案

Fiddler断点图文讲解

mysql数据库source命令导入sql文件记录
随机推荐
【ASM】字节码操作 MethodVisitor 案例实战 cinit 方法生成
Measure the size of objects in an image using OpenCV
Rust is one of the common problems: Blocking waiting for file lock on package cache
Realize the Circle Fill effect of Sprite and solve the problems in the atlas
mysql master-slave replication deployment
周末复盘,高手不卖产品只讲故事!
8.cuBLAS开发指南中文版--cuBLAS中的cublasGetMatrix()和cublasSetMatrix()
在一个页面实现数据库的增删改查
红队web打点信息收集
Navicat连接mysql一段时间未操作之后卡住几秒
7. CuBLAS development in the Chinese version - cuBLAS guide cublasSetVector () and cublasGetVector ()
实现Sprite的Circle Fill效果及打了图集出现的问题
学习笔记:时间复杂度和空间复杂度
【Unity入门计划】GameObject类(1)-GetComponent方法
MySQL报错原因:ERROR 1292 (22007): Incorrect date value: ‘1988‘ for column ‘birthday‘ at row 1
实战 || 某软件股份有限公司通用漏洞挖掘
5 Practical SQL Examples for Mastering SQL GROUP BY in SQL Tutorial (including complete SQL and test data)
ReentrantReadWriteLock读写锁
Controller Layer Coding Specification
2022/8/6