|
On Thu, 4 Sep 2003, Joel Cochran wrote: > The only odd thing is that while the QzshSystem commands are working > correctly, I always get the 'Path or Directory Not Found' error. I'm > getting it after the mkdir command also (as seen indebug). But it still > works... You shouldn't use errno to determine if an error occurred. Errno always contains the last error that occurred. So if you did this: rmdir('/foo/bar') <--- this generates a "path not found" mkdir('/foo/bar':511) <--- this is successful errno may still be set to "path not found" Instead, you need to use the return values from the actual APIs to first determine *IF* an error has occurred, and then query errno to see what happened. if (rmdir('/foo/bar') < 0); msg = %str(strerror(errno)); send_escape_msg(msg); endif; if (mkdir('/foo/bar': 511) < 0); msg = %str(strerror(errno)); send_escape_msg(msg); endif; See the difference? I only check errno if an error has occurred. With QzshSystem(), if it returns a -1, then the QzshSystem() API itself failed, in that case you can check errno. But, if you get a number higher than 0, that means that the command that it ran failed. This does not set errno, but rather returns the exit code that the called program specified. So, if you get higher than 0, you don't want to check errno. Hope that helps...
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.