In my application, I allow the user to search for a file (or files) using a pattern they specify. My tester reported that an error occurs (returned ERROR_CODE is non-zero), and I have verified this does occur.
Once this error occurs (for the second and subsequent tries), the ERROR_CODE is returned as 183 (IOSTAT says this is a bad macro being executed), but the number of files found is the appropriate number.
The documentation only shows the error ERANGE when the array to store the names is not big enough, but I cannot find the errno.ins file the documentation references. I did find errno.h, where ERANGE=1001.
I'm thinking that unless the ERANGE error is returned to trust the returned number of files.