Ok, I have a text file that I am reading into buffers, and it breaks after around 107 lines of the file have been scanned. Any help would be greatly appreciated.
p.s. Sorry about all the extra printf's, it's just for debugging. (didn't help ;-)Code:void ReadFile(struct SListHeader *ListInfo, FILE *pFLocation) { int i; char *acLineBuffer; char acStateBuff[4], acCityBuff[41], acLatBuff[8], acLongBuff[8], acPopBuff[10], acZipBuff[8]; acLineBuffer = (char*)malloc(100 * sizeof(char)); if (acLineBuffer == NULL) { printf("\n\nOut of Memory!!!\n\n"); /* Insert Memory Error Check Here */ } while ( fgets(acLineBuffer, 99, pFLocation) ) { for ( i=0; acLineBuffer[0] != ','; i++ ) { acCityBuff[i] = acLineBuffer[0]; acLineBuffer++; } acCityBuff[i] = '\0'; acLineBuffer++; printf("\n%s read from file.... ", acCityBuff); printf("\n%s", acLineBuffer); for ( i=0; acLineBuffer[0] != ','; i++ ) { acStateBuff[i] = acLineBuffer[0]; acLineBuffer++; } acStateBuff[i] = '\0'; acLineBuffer++; printf("\n%s - ", acStateBuff); printf("\n%s", acLineBuffer); for ( i=0; acLineBuffer[0] != ','; i++ ) { acZipBuff[i] = acLineBuffer[0]; acLineBuffer++; } acZipBuff[i] = '\0'; acLineBuffer++; printf("\n%s - ", acZipBuff); printf("\n%s", acLineBuffer); for ( i=0; acLineBuffer[0] != ','; i++ ) { acLatBuff[i] = acLineBuffer[0]; acLineBuffer++; } acLatBuff[i] = '\0'; acLineBuffer++; printf("\n%s - ", acLatBuff); printf("\n%s", acLineBuffer); for ( i=0; acLineBuffer[0] != ','; i++ ) { acLongBuff[i] = acLineBuffer[0]; acLineBuffer++; } acLongBuff[i] = '\0'; acLineBuffer++; printf("\n%s - ", acLongBuff); printf("\n%s", acLineBuffer); for ( i=0; acLineBuffer[0] != '\n'; i++ ) { acPopBuff[i] = acLineBuffer[0]; acLineBuffer++; } acPopBuff[i] = '\0'; printf("\n%s - ", acPopBuff); printf("\n%s", acLineBuffer); printf("\nReady to insert node....."); } return; }



LinkBack URL
About LinkBacks


