How do I get the battery percent, if the battery is charging or not, if it is connected to the ac adapter, and the temperature in linux using c/c++?
Look at virtual files in
/sys/class/power_supply/BAT0/
and
/sys/class/thermal/thermal_zone0/
you may read them using traditional I/O
Another option is to use external application to get it for you, look at "acpi" command.
You can call it using system() call.