using scanf and family to read in two strings separated by a space from a file in c

I am trying to read in 2 string that are separated by a space from a file. Whatever I try I keep getting the 1st string initialized but the second string is always NULL. Some of the formatters that I have tried are `"%s%s"` , `"%s %s"` , `"%s[\n\t ]%s"` Any ideas of what I am doing wrong? I think it has to do with the internal buffer of scanf -- reads the first `%s` then puts some invisible character in buffer reads that with 2nd `%s` which then is read and the second string is `NULL` when complete.
Can you post your complete code sample?

以上就是using scanf and family to read in two strings separated by a space from a file in c的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏