当前位置:网站首页>C library function - sscanf() usage
C library function - sscanf() usage
2022-07-18 14:53:00 【Alkali!】
Reference link :https://www.runoob.com/cprogramming/c-function-sscanf.html
describe
C Library function int sscanf(const char *str, const char *format, ...) Read from string Format input .
Statement
Here is sscanf() Declaration of functions :
int sscanf(const char *str, const char *format, ...)
Parameters
str– This is a C character string , Is the source of data retrieved by the function .- format – This is a C character string , Contains one or more of the following : Space character 、 Non space characters and format specifier .
Return value
If it works , This function returns Number of successful matches and assignments . If you get to the end of the file or have a read error , Then return to EOF.
example
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int day, year;
char weekday[20], month[20], dtm[100];
strcpy( dtm, "Saturday March 25 1989" );
sscanf( dtm, "%s %s %d %d", weekday, month, &day, &year );
printf("%s %d, %d = %s\n", month, day, year, weekday );
return(0);
}
Let's compile and run the above program , This will produce the following results :
March 25, 1989 = Saturday
边栏推荐
- angr原理与实践(一)——原理
- 真值与条件表达式
- Uninstall cuda11.1
- How about the income of increased life insurance? Can it be a pension financial product?
- 小程序畢設作品之微信評選投票小程序畢業設計(5)任務書
- Mitmproxy getting started installation
- Conditional ternary operator...
- Total sequencing problem
- C 库函数 - sscanf()用法
- Stonedb announces open source, why is the integrated real-time HTAP architecture the current best solution
猜你喜欢

2022年A特种设备相关管理(电梯)操作证考试题及在线模拟考试

SLAM_旋转运动学_两个坐标系速度v和加速度a的关系

STM32应用开发实践教程:具备交互功能的人机界面应用开发

Angr principle and Practice (I) -- principle

Total sequencing problem

2022危险化学品经营单位安全管理人员操作考试题及答案

Antd a-upload limit the number of uploads when multiple is true

SLAM_ Rotational kinematics_ Relationship between velocity V and acceleration a in two coordinate systems

配置MaskRCNN环境吐槽(GeForce MX250+win10+tensorflow1.5.0 GPU版)

Win11 system How to enable Net Framework 3.5?
随机推荐
7-redis architecture design to use scenarios - cache penetration, cache avalanche, cache preheating, cache degradation
Variables in shell scripts
6. Redis architecture design to use scenarios - persistence mechanism, cache invalidation strategy, cache hit rate
Design of intelligent speech recognition Bluetooth headset based on wtk6900h speech recognition single chip
I "bring salt" for tdengine! "High price" to recruit photographed developers
博云入选 Gartner 中国云管理工具市场指南代表厂商
小程序毕设作品之微信评选投票小程序毕业设计(6)开题答辩PPT
Eureka read-write lock fantasy, too top!
2022年G2电站锅炉司炉考试试题模拟考试平台操作
关于mock第三方调用
Finding the median in data flow
Conditional ternary operator...
压力测试工具(常用)和sendfile的过程
06-GuliMall 基础CRUD功能创建
Going to sea has become a general trend. How can technology be empowered| ArchSummit
为什么电商平台要重点关注非法经营罪,这与二清又有什么关联?
StoneDB 宣布开源,一体化实时 HTAP 架构为何是当前最优解
antd a-upload 多选multiple为ture时 限制上传个数
Conditional ternary operator...
Top k high frequency elements