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前端其它相关文章！