S
sieg1974
Hi,
I have a linked list with 705 nodes, and the functions getContact and
listContact to deal with it. listContact works properly, and prints all
some debug information about each node. On the other hand, getContact
breaks when it reaches the 580th node although it's almost identical to
listContact .
Does anyone have any idea about what is wrong?
Thanks,
Andre
#define MAX_STR 127
typedef struct
{
char ContactName[MAX_STR + 1];
}CONTACT_ENTRY;
struct ContactNode
{
struct ContactNode * Next;
struct ContactNode * Previous;
CONTACT_ENTRY Contact;
};
void listContact( struct ContactNode * ContactListHead, unsigned int
counter )
{
FILE * pFile = fopen("./test.txt", "a");
fprintf( pFile, "%04d %07X %07X %07X\n",
counter,
ContactListHead->Previous,
ContactListHead,
ContactListHead->Next);
fflush(pFile);
fclose(pFile);
if( ContactListHead->Next != 0 )
{
listContact( ContactListHead->Next, ++counter );
}
}
CONTACT_ENTRY getContact( struct ContactNode * ContactListHead,
unsigned int counter )
{
FILE * pFile = fopen("./test.txt", "a");
fprintf( pFile, "%04d %07X %07X %07X\n",
counter,
ContactListHead->Previous,
ContactListHead,
ContactListHead->Next);
fflush(pFile);
fclose(pFile);
if( ContactListHead->Next != 0 )
{
getContact( ContactListHead->Next, ++counter );
}
return ContactListHead->Contact;
}
I have a linked list with 705 nodes, and the functions getContact and
listContact to deal with it. listContact works properly, and prints all
some debug information about each node. On the other hand, getContact
breaks when it reaches the 580th node although it's almost identical to
listContact .
Does anyone have any idea about what is wrong?
Thanks,
Andre
#define MAX_STR 127
typedef struct
{
char ContactName[MAX_STR + 1];
}CONTACT_ENTRY;
struct ContactNode
{
struct ContactNode * Next;
struct ContactNode * Previous;
CONTACT_ENTRY Contact;
};
void listContact( struct ContactNode * ContactListHead, unsigned int
counter )
{
FILE * pFile = fopen("./test.txt", "a");
fprintf( pFile, "%04d %07X %07X %07X\n",
counter,
ContactListHead->Previous,
ContactListHead,
ContactListHead->Next);
fflush(pFile);
fclose(pFile);
if( ContactListHead->Next != 0 )
{
listContact( ContactListHead->Next, ++counter );
}
}
CONTACT_ENTRY getContact( struct ContactNode * ContactListHead,
unsigned int counter )
{
FILE * pFile = fopen("./test.txt", "a");
fprintf( pFile, "%04d %07X %07X %07X\n",
counter,
ContactListHead->Previous,
ContactListHead,
ContactListHead->Next);
fflush(pFile);
fclose(pFile);
if( ContactListHead->Next != 0 )
{
getContact( ContactListHead->Next, ++counter );
}
return ContactListHead->Contact;
}