Fix trailing slashes which leads to segfault.
Add extra check to opened file opointer.
Make sure friend message is null-terminated else generate garbate on screen.
Merge pull request #56 from aitjcize/bugfix

Make sure friend message is null-terminated else generate garbate on screen
Merge pull request #55 from aitjcize/fix-path-name

Fix trailing slashes which leads to segfault.