|
That did return the pointer back, but the original string was modified. String sent '70500607050AEI02x' String returned 'J0500607050AEI02x' I was expecting to get just the value J which is the check digit that got generated. On 4/20/05, Elvis Budimlic <ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > > What if you use: > > // Mod 36 Check bit calculator > char* Pr_ChkDigit(char *str) > { > > char chkdigit; > > //Calcuations > // Get checkbit from the Mapping Matrix > chkdigit=reverse_map(c1,c2) ; > *str = chkdigit; > return str; > > } > > -----Original Message----- > From: c400-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx > [mailto:c400-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx] > On > Behalf Of Krish Thirumalai > Sent: Wednesday, April 20, 2005 3:42 PM > To: c400-l@xxxxxxxxxxxx > Subject: [C400-L] Returning character variables from C to RPG > > Writing my first program in C in the ILE environment and I am really > puzzled. > > I have the following RPG program that is calling a C function, but all i > get > > back is a Null each time. If i put it in debug mode i can see that the > value > > of chkdigit is correct, but then, when i get it back in my RPG, the value > is > > NULL. > > Can someone point out what i am doing wrong ? > > RPG program > > D Pr_ChkDigit PR * ExtProc('Pr_ChkDigit') > D * Options(*string) value > > D Wrk_Str s 36A > D Wrk_Null s 1A Inz(X'00') > D Wrk_ChkDigit s 1A > D Ptr_ChkDigit s * INZ(%ADDR(Wrk_ChkDigit)) > > /Free > Wrk_Str = '70500607050AEI02x' + Wrk_Null; > Ptr_ChkDigit = Pr_ChkDigit(%Addr(Wrk_Str)); > Dsply Wrk_ChkDigit; > *InLr = *on; > /End-Free > > C service program > > // Mod 36 Check bit calculator > char* Pr_ChkDigit(char *str) > { > > char chkdigit; > char* check_bit; > > //Calcuations > // Get checkbit from the Mapping Matrix > chkdigit=reverse_map(c1,c2) ; > *check_bit = chkdigit; > return check_bit; > > } > > -- > Krish Thirumalai > _______________________________________________ > This is the C programming iSeries / AS400 (C400-L) mailing list > To post a message email: C400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/c400-l > or email: C400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/c400-l. > > _______________________________________________ > This is the C programming iSeries / AS400 (C400-L) mailing list > To post a message email: C400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/c400-l > or email: C400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/c400-l. > > -- Krish Thirumalai
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.