|
Thanks for your suggestions Scott. I didn't realize that the getpwnam() API even existed. I'll check it out. -Paul -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Scott Klement Sent: Thursday, March 17, 2005 11:30 PM To: RPG programming on the AS400 / iSeries Subject: Re: Data translation question > I am calling API QSYRUSRI to get the user profile Home Directory, but the > structure that the info comes back into has the directory name formatted as > CCSID 1200. You can use the iconv() API to translate the result. There should be examples of calling the iconv() API in the archives, I'm pretty sure I've posted some before. If you can't find any, let me know. Personally, I'd use the getpwnam() API to get the home directory. It's just easier to use. Here's an example of an RPG program that's intended to be called by CL to get a user's home directory: H DFTACTGRP(*NO) D passwd DS qualified D BASED(Template) D pw_name * D pw_uid 10U 0 D pw_gid 10U 0 D pw_dir * D pw_shell * D getpwnam PR * ExtProc('getpwnam') D name * Value options(*string) D p_info s * D info ds likeds(passwd) D based(p_info) D peUser s 10A D peHomeDir s 256A C *entry plist c parm peUser c parm peHomeDir c eval p_info = getpwnam(%trimr(peUser)) c if p_info = *NULL c*** error occurred. Check errno to find out what went wrong. c endif c eval peHomedir = %str(info.pw_dir) c return -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.