Programming optical shaft encoder

Hi everyone
Currently I do not have access to easyC and I was wondering if anyone is able to show me a sample code for optical shaft encoders.

So which programming language are you asking for help in, EasyC or ROBOTC?

EasyC pro.