The system()
function runs a program. If you know a command line that does what you need, you can use system()
to run that command line.
I'm not sure what command-line program would give the number of accounts on Windows. You could get an approximation by looking at the number of home directories. On Windows the home directories are in Users
and on Linux home directories are in `/home'.
The system()
function doesn't capture the output of the program. You would then likely need to run a command line that redirects the program output to a file, then open this file and parse the output.
You would probably have an easier time solving this problem using a language like Python. Python programs are very portable and there are some wrappers for system stuff.
Good luck.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…