Minor fixes: fixed fread() warning, added login error handling to examples/test_*

Here you have some minor fixes:
- fixed fread() warning #26
- added error handling to example tests (it was confusing)  #19