I am not sure if this will help as the library is in Java. But I found it really cool, as it is capable of detecting about 50 languages ββfrom a given text and with a fairly good level of accuracy. You might like to take a look at it, and since it is open source, you can rewrite the code in C ++ and return it to the open source community if your application should only be written in C ++.
Here is a link to the same:
http://code.google.com/p/language-detection/
Note. For analysis, the Apache Nutch and Tika libraries are used.
source share