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.)