this a great tutorial that i used, and its got tons of explaination and code:

http://www.inf.pucrs.br/~derose/file...ktutorial.html

hope that helps