When you call SYSTEM you are starting a new process which then executes the command that you are passing. The return-code returned is simply whether or not that command was executed and is not the return value from the command itself.
If you want to get dir listing information directly into your program then I would recommend that you use the library routines CBL_DIR_SCAN_START, CBL_DIR_SCAN_READ and CBL_DIR_SCAN_END,
There is an example for this in the docs and also another small example in the article here: