Quadrature Encoders using interrupts

I want to use quadrature encoders for my project. I m able to get the ticks counts.
What is currently know is to read the value from the file named “Position” from the path described in this library

https://github.com/Teknoman117/beaglebot/tree/master/encoders

It uses fstream library to read from the position file but i need a more faster way.
like directly attachInterrupt or anything else better.