|
Hello,
IMHO, it would make more sense to return a character than to return a pointer! That way, you won't have to worry about the memory being freed up.
D Pr_ChkDigit PR 1A ExtProc(*CWIDEN: 'Pr_ChkDigit')
D str * value options(*string) D Wrk_Str s 36A
D Wrk_ChkDigit s 1A /free
Wrk_ChkDigit = Pr_ChkDigit('70500607050AEI02x');
dsply Wrk_ChkDigit;
*inlr = *on;
/end-freeOr, if you prefer to put the number into a variable:
/free
Wrk_Str = '70500607050AEI02x';
Wrk_ChkDigit = Pr_ChkDigit(%trimr(WrkStr));
dsply Wrk_ChkDigit;
*inlr = *on;
/end-freeAnd the C function should look like this:
char Pr_ChkDigit(const char *str)
{
char chkdigit;
chkdigit = reverse_map(c1,c2);
return chkdigit;
} char Pr_ChkDigit(const char *str)
{
return reverse_map(c1,c2);
}Anyway, hope that helps.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.