Database - PSQL Command

In my Qt application, I'm using a PostgreSQL database, and I would like to know if it's possible to run a command as I do through the psql console ? (example : "\copy (select * from variable) To '/tmp/export_bdd.csv' With CSV")