how to read a string from a \n delimited file

后端 未结 5 521
天涯浪人
天涯浪人 2021-01-18 10:20

I\'m trying to read a return delimited file. full of phrases.

I\'m trying to put each phrase into a string.

The problem is that when I try to read the file w

5条回答
  •  没有蜡笔的小新
    2021-01-18 11:18

    Avoid using scanf. As already mentioned, you should use fgets instead.

    If you don't want to use a fixed-size buffer and to allow lines of arbitrary length, you can try using Chuck Falconer's public domain ggets function. (That link seems to be down right now, but archive.org has a copy.)

提交回复
热议问题