GetLubuntuVersionCodename is a version code snippets to obtain the version of the current Lubuntu distibution's codename.
#include <cstdlib> #include <fstream> #include <string> #include <vector> #include <boost/foreach.hpp> ///GetLubuntuVersionCodename returns the codename of the Lubuntu distribution currently installed. ///From http://www.richelbilderbeek.nl/CppGetLubuntuVersionCodename.htm const std::string GetLubuntuVersionCodename() { //Save info to tmp.txt { std::system("cat /etc/*-release > tmp.txt"); } //Read info to std::vector std::vector<std::string> v; { std::ifstream f("tmp.txt"); std::string s; for (int i=0; !f.eof(); ++i) { std::getline(f,s); v.push_back(s); } } //Analyze std::vector BOOST_FOREACH(const std::string& s,v) { if (s.size() > 16 && s.substr(0,16)=="DISTRIB_CODENAME") { const int i = s.find_last_of("="); return s.substr(i+1,s.size()-(i+1)); } } return ""; }