I need to read a string from the input but I don't know the length of it. So I would like to read for example first 100 chars, then next 100 chars and so on, till '\n'. I though about using scanf() in such a form: scanf("%100s", buf); but I don't know the condition to check if the line is over. I can't wait for EOF from scanf() because I have a few lines to read. I don't want to read this string char by char. Can anyone help me?