Thanks for reply all of you..
I have not just copy the original code because the variables are in
german. So for better reading i give you the code "translated" to
english.
First of all I' am looking if this could be work. I can not test it
yet.
-RECL is a syntax error it should be REC. -> re typing error
<I would rather use size_t instead of int -- the guaranteed upper
bound of int is 32K-1... >
--> int is okay this array has a limit to 100 items. ( makes another
part of my program )
@Barry Schwarz and all others
I give you the original code
typedef struct tagRECLIEFNR
{
char vertrag[LEN_SAP_AUFTRAG+1];
char lieferscheinnr[LEN_SAP_LSCHEIN+1];
char liefText[LEN_SAP_LIEFTXT+1];
int stk;
}
RECLIEFNR;
typedef struct tagTABLIEFNR
{
int anz; // = counts of lief
int size; // Gr"áe Feld lief
RECLIEFNR *lief; // dynamic Filed with size size and count anz
}
TABLIEFNR;
static void RemoveDoppelteLSEintraege( TABLIEFNR *tsource )
{
int i,j;
RECLIEFNR *source;
RECLIEFNR *dest;
source = tsource->lief;
dest = source;
j=0;
i=0;
//found = FALSE;
if ( tsource->anz-1 < 0 )
return;
for (i = 0; i < tsource->anz-1; i ++ )
{
// no double entrie
if ( strcmp ( (source+i)->lieferscheinnr,
(source+1+i)->lieferscheinnr) != 0 )
{
*(dest+j) = *(source+i);
j++;
//found = FALSE;
}
}
// for the last entrie
*(dest+j) = *(source+i);
j++;
tsource->anz = j;
}
The problem with the anz < 1 should be now no problem.
Will this code work ?
And i know that this style *(dest+j) is'nt the best. I will change it
when i have time.
Thanks a lot
ebc