The following Linux command returns a single integer representing the number of cores on the processor (physical, not virtual cores):
grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}'
What is the best way to call this command in C and assign the result to a variable?