Thanks for answering.
What you propose its not correct since read() is a void. I actually posted this yesterday but my account wasn’t validated until today. I’ve found this post which should solve my problem but it just makes it a little bit better. I’ve made a comment with my current problem there.
It’s a little bit old, but I’m hoping I can get some help