The Open Source C Clustering Library from the Human Genome team at the University of Tokyo looks promising. It has K-means as well as other flat hierarchical clustering algorithms. Scroll down in their page for the bare library without the GUI. The Wikipedia-Clustering project seems nice and a bit lighter. Here's a specialized K-means library from The University of Mariland.
I suggest you look at these considering your type of data. Preprocessing data to create feature vectors may be challenging.