I can do this through command line:
set DB2INSTANCE=db2inst2
db2cmd /i db2 list database directory
set DB2INSTANCE=db2
db2cmd /i db2 list database directory

I'm trying to get the same result in a c++ application using db2 api. Anybody knows how to do this?

Thanks.