PDA

View Full Version : Retrieve installed package version from C/C++?



bedge
December 11th, 2008, 06:42 AM
I'm looking at libapt-front-dev. but I can't find any docs for it.
I hate using popen("dpkg -l bork | sed ...") to get version info.

What's the _right_ way?

Or, please point me to the libapt-front-dev docs and I'll RTFM.

Thanks, Bruce

nvteighen
December 11th, 2008, 03:25 PM
You have two reasonable options:

0. Use some shell script to grep the result from apt-get/aptitude show. (Why not?)
1. Use the libapt-* family of libraries and have an application natively aware of the packaging system. But IMO this is senseful only if you're developing an application that needs to have that functionality among others.