Whether or not it's safe depends on the assumptions made when calling the function. If all callers ensure that 'buffer' has at least 1024 bytes available, then your macro should work. If they make different assumptions, there's a chance of overrunning memory.

Assuming that you're doing this to port existing software, I'd grep (or FNDSTRPDM) the software for everywhere it calls getwd, and see how those vars are defined.

If you're doing this for new software, please just use getcwd in the first place. Don't use getwd.

On 12/9/2010 7:59 AM, Schmidt, Mihael wrote:

as getwd is not available on IBM i but getcwd is, is it safe to do the following:

#define PATH_MAX 1024
#define getwd(buffer) getcwd(buffer, PATH_MAX)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.