Whats wrong? I’m pretty sure my syntax is correct since it has no warnings. Plus it won’t go past getc(document); I tried fgetc(document); same result. What am I not getting here? (I used printf("$"); to see where it crashes)
char temp[51];
int cntr = 0,listcntr = 0,buffer;
FILE *document;
contact list[MAXCONTACTS];
document = fopen("addressbook.txt","r");
do
{
for(cntr = 0;cntr < 51; cntr++)
temp[cntr] = '\0';
cntr = 0;
do
{
buffer = getc(document);
printf("$");
if(buffer != '\t')
temp[cntr] = buffer;
++cntr;
}while(buffer != '\t'&& buffer != EOF);
list[listcntr].name = temp;
OK I modified your code a little and added a couple of checks, maybe it will be enough.