× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Shannon ODonnell wrote:
If I hard code a directory path where PathName is, it works. If I
pass a directory into the program in an *ENTRY PLIST, it doesn't.

Because of the 32-char rule. When you pass a parameter that's longer than 32-characters long, you need to make a command (*CMD) interface for your program.

There's a FAQ entry on Midrange.com that explains the 32-char parameter rule. (Questions surrounding parameters larger than 32 chars are probably the single most frequently asked questions in these forums.) Here's a link:

http://faq.midrange.com/index.pl?file=70

The correct way to prototype opendir() is to use options(*String) (and perhaps also *trim) on the prototype. Unless you need to support V3R2 (or earlier) there's absolutely no reason to manually add the x'00' or pass %addr() to the API. Let's not make our code more confusing than it has to be!

Even more confusing was the %trim(x'00') in your code! What do you think that's going to trim? You only specified ONE byte, and it wasn't a space.... what do you think will be trimmed?

To add to that... when Opendir() Fails, it's a good idea to find out WHY it failed. In other words, retrieve the error message (using __errno() and strerror()) so that you know what the problem is. If it wasn't for the fact that you made an extremely common mistake, I wouldn't have had a clue where to look for the problem, since all you could tell me was that it failed, and not WHY it failed. Use __errno() and strerror() to get some better info.

Anyway... the solution to your problem is to create a *CMD front end. Then you can put options(*string) back on your prototype, and simply have opendir(%trim(In_dirname));

Good luck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.