在非STDIN输入上的scanf [英] scanf on non-STDIN input
本文介绍了在非STDIN输入上的scanf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在不是STDIN的输入上运行 scanf
?我的意思是,如果我有一个 string ="hello 1 2 3"
,我可以对它运行scanf来提取字符串和三个整数吗?
Is it possible to run scanf
on input that it is not STDIN? What I mean is if I have a string="hello 1 2 3"
, can I run scanf on it to extract the string and three integers?
还有另一个功能可以做到这一点吗?
Is there another function that can do this?
推荐答案
sscanf
在字符串上(信息 fscanf
放在文件上(信息此处)
类似地 sprintf 和
similarly sprintf and fprintf to write to a string/file.
这篇关于在非STDIN输入上的scanf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文