How can i retrieve some specific lines from a file using C

Plz tel me how to retrieve some specific set of lines from a file and store it in a char buffer.I am seperating each record by ":"

22:abc:4
hardware:cd:xyz:2
hardware:eth:abc:6
hardware:mouse:xyz:3
hardware:ram:xyz:1

23:cde:3
hardware:cd:xyz:2
hardware:eth:abc:6
hardware:ram:xyz:1

25:efg:2
hardware:cd:xyz:2
hardware:eth:abc:6 

plz tel me how to retrieve

23:cde:3
hardware:cd:xyz:2
hardware:eth:abc:6
hardware:ram:xyz:1 

from the file and store it in a buffer using C.Kindly help me in this

learn about fseek() function or lseek() system call

Thanx

use an embedded database instead ( sqlite/cdb...)