Re: C program for QDFRTVFD API
Jevgeni Astanovski <[email protected]>
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <CAJuVQr0MfVLtLnFJibjgDvAxesMjOHM3O7UojPDd+0Tdk4W_GQ@mail.gmail.com> |
This part of code is invalid, I think:
if (!memcmp(Functn , "#NEXT" , 5))
{
if (!memcmp(p_iRecord, Odata->RecordName, sizeof(*p_iRecord)))
{
if(!memcmp(p_iField, Odata->FldNam, sizeof(*p_iField) ))
{
if(!memcmp(p_iRow, Odata->ROW, sizeof(*p_iRow) ))
{
if(!memcmp(p_iCol, Odata->COL, sizeof(*p_iCol)))
{
*GotIt = 1;
}
}
}
}
}
If understand correctly your intention, you wanted to compare 2 record
names, 2 field names, row and column of the 2 fields.
But in fact I think that you only compare the first character of the 2
records and the first character of the field names as
sizeof(*p_iRecord) equals to 1.
I would write it so:
if (!memcmp(Functn , "#NEXT" , 5) &&
!memcmp(p_iRecord, Odata->RecordName, 10) &&
!memcmp(p_iField, Odata->FldNam, 10 ) &&
(*p_iRow == *Odata->ROW) &&
(*p_iCol == *Odata->COL))
*GotIt = 1;
On Mon, Sep 22, 2014 at 12:51 PM, Frank Kolmann <[email protected]> wrote:
> Hi Jevgeni
>
> I am glad your program is now working, it was your original question
> that prompted my to make a program that uses the API.
>
> Seems there are many ways to skin a cat and what you say to store the
> pointer of the previous field is more efficient.
>
> You mention debugging my program.
> What bug did you find? I would like to correct it.
> As you may guess I dont believe my code is 'dangerously inefficient'.
> Yes my code is not the most efficient but it was mostly a demonstration
> of how to process the API data, and as such it has succeeded.
>
> Regards
> Frank
>
>
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.