%shellcapture() function

The %shellcapture() function executes the MS-DOS command, command, and captures the result in the buffer variable, up to the maximum size. If the buffer is not large enough, the exceeding output is discarded.


code = %shellcapture(command, buffer, size, read)


This form should be used when the expected output is small. The size of the buffer is returned in read. If there is not enough space in the provided buffer, read is set to the maximum value size.

This function returns 0 if successful.


The %shellcapture() function executes an executable file, not the command built-ins. For example, to list a directory (DIR), type the following, or something similar:

%shellcapture("cmd /c dir", buffer, buffsize, &readsize)