college assignment,text file~

i can read the first customer detail only,others cant read....how it work to read all customer?
here my code~

void main() {
system("color 8a");

SYSTEMTIME t;
int choice, txnCode;


/*TARBANK Logo
printf("\n\ ========== __ ~~~~> ~~~~>\n");
printf("\n\||===||===|| / \ | @@ > | @@ >\n");
printf("\n\ || / /_ \ | @ > | >\n");
printf("\n\ || / /__\ \ | << | <<\n");
printf("\n\ || / / \ \ | \ \ | @@ >\n");
printf("\n\ || /_/ \_\ | \ \ |___ >\n");
*/

//Display Today's Date and Time
GetLocalTime(&t);
printf("\t\tDate! Today is %d/%d/%d and \n\
it's %d:%d:%d now.\n\n", t.wDay, t.wMonth, t.wYear, t.wHour, t.wMinute, t.wSecond);

printf("\t\tCustomer:Press 1\n");
printf("\t\tManager:Press 2\n\n");
printf("\t\tYour choice: ");
scanf("%d", &choice);
if(choice == 1) {
fptr1 = fopen("Customer.txt", "r");
fptr2 = fopen("Customer_temp.txt", "w");

//Check if customer.txt can be opened or not
if(fptr1 == NULL || fptr2 == NULL) {
printf("ERROR in opening file!Try again.....");
exit(-1);
}

//Randomly generate ATM No.(6-10)
srand(time(NULL));
atm = (rand() % 5) + 6;
//Display ATM No.
printf("ATM No: %d\n", atm);

//Prompt and read user's A/C No.
printf("\t\tPlease enter your A/C No:\t\t_____\b\b\b\b\b");
scanf("%s", &temp.accNo);
fflush(stdin);

//Prompt and read user's PIN No.
printf("\t\tPlease enter your PIN No:\t\t_____\b\b\b\b\b");
scanf("%s",temp.PIN);
fflush(stdin);

//Read customer.txt
while(!feof(fptr1)) {
for(int i = 0; i < 10; i++) {
fscanf(fptr1, "%[^|]|%[^|]|%[^|]|%c|%[^|]|%[^|]|%[^|]|%d|%d%d%d%d%d%d",
&customer[i].accNo, &customer[i].PIN, &customer[i].name, &customer[i].gender,
&customer[i].address, &customer[i].state, &customer[i].contact,
&customer[i].balance, &customer[i].lastTxn.date, &customer[i].lastTxn.month, &customer[i].lastTxn.year,
&customer[i].lastTxn.hr, &customer[i].lastTxn.min, &customer[i].lastTxn.sec);

//Check if the results match(update is pending)
if(strcmp(temp.accNo, customer[i].accNo) == 0 && strcmp(temp.PIN, customer[i].PIN) == 0) {
customerCode = i;

strcpy(temp.name, customer[i].name);
temp.balance = customer[i].balance;

temp.gender = customer[i].gender;
strcpy(temp.address, customer[i].address);
strcpy(temp.state, customer[i].state);
strcpy(temp.contact, customer[i].contact);
temp.lastTxn.year = customer[i].lastTxn.year;
temp.lastTxn.month = customer[i].lastTxn.month;
temp.lastTxn.date = customer[i].lastTxn.date;
temp.lastTxn.hr = customer[i].lastTxn.hr;
temp.lastTxn.min = customer[i].lastTxn.min;
temp.lastTxn.sec = customer[i].lastTxn.sec;
}
}
}

printf("\n");
printf("Name: %s\n\n", temp.name);
printf("Balance: RM%d\n\n", temp.balance);

printf("Last Transaction Date: %d/%d/%d %d:%d:%d\n\n", temp.lastTxn.date, temp.lastTxn.month, temp.lastTxn.year,
temp.lastTxn.hr, temp.lastTxn.min, temp.lastTxn.sec);

here is the customer.txt~
12345|54321|Tao Ka Cheng |M|12 Jalan 3/45 KL |Wilayah P|012-3456789|5000| 3 10 2015 2 30 00
12350|05321|Lim Ke Yuan |F|13 Jln 5/50 Gtown |Penang |013-4567890|4000| 4 10 2015 4 30 00
12355|55321|Lin Lao ba |F|14 Jalan 7/15 KK |Sabah |014-5678901|2000| 4 10 2015 2 00 00
12360|06321|Chau Ah Gua |M|15 Jalan 2/25 Ipoh |Perak |015-6789012|3000| 5 10 2015 4 30 00
12365|56321|Marempit Chong|M|16 Jalan 1/34 Muar |Johor |016-7890123|5000| 7 10 2015 8 30 00
12370|53344|Kang Mei Mei |F|17 Jalan 6/45 SP |Sungai P |012-1234489|6000| 6 10 2015 2 30 00
12375|02543|Lu Ka Jik |M|18 Jln 9/50 Gtown |Penang |013-5456790|8000| 8 10 2015 4 30 00
12380|08333|Wong Ji Ji |F|19 Jalan 1/60 KK |Sabah |014-5754301|1000| 12 10 2015 2 10 00
12385|01232|Chau JohnCena |M|20 Jalan 45/65 Ipoh|Perak |015-6778912|4500| 17 10 2015 4 40 00
12390|33452|Jessyna Lai |F|21 Jalan 12/34 Muar|Johor |016-1232023|7000| 27 10 2015 8 50 00
Last edited on
accNo, PIN, name, gender, address, state, contact balance, lastTxn date,month,year,hr,min,sec
12345|54321|Tao Ka Cheng |M|12 Jalan 3/45 KL |Wilayah P|012-3456789|5000| 3 10 2015 2 30 00
12350|05321|Lim Ke Yuan |F|13 Jln 5/50 Gtown |Penang |013-4567890|4000| 4 10 2015 4 30 00
12355|55321|Lin Lao ba |F|14 Jalan 7/15 KK |Sabah |014-5678901|2000| 4 10 2015 2 00 00
12360|06321|Chau Ah Gua |M|15 Jalan 2/25 Ipoh |Perak |015-6789012|3000| 5 10 2015 4 30 00
12365|56321|Marempit Chong|M|16 Jalan 1/34 Muar |Johor |016-7890123|5000| 7 10 2015 8 30 00
12370|53344|Kang Mei Mei |F|17 Jalan 6/45 SP |Sungai P |012-1234489|6000| 6 10 2015 2 30 00
12375|02543|Lu Ka Jik |M|18 Jln 9/50 Gtown |Penang |013-5456790|8000| 8 10 2015 4 30 00
12380|08333|Wong Ji Ji |F|19 Jalan 1/60 KK |Sabah |014-5754301|1000| 12 10 2015 2 10 00
12385|01232|Chau JohnCena |M|20 Jalan 45/65 Ipoh|Perak |015-6778912|4500| 17 10 2015 4 40 00
12390|33452|Jessyna Lai |F|21 Jalan 12/34 Muar|Johor |016-1232023|7000| 27 10 2015 8 50 00

here my customer text file~
You need to skip the first line of the file or remove it.
1
2
3
4
5
6
7
8
//Read customer.txt
while(!feof(fptr1)) {
for(int i = 0; i < 10; i++) {
fscanf(fptr1, "%[^|]|%[^|]|%[^|]|%c|%[^|]|%[^|]|%[^|]|%d|%d%d%d%d%d%d",
&customer[i].accNo, &customer[i].PIN, &customer[i].name, &customer[i].gender,
&customer[i].address, &customer[i].state, &customer[i].contact,
&customer[i].balance, &customer[i].lastTxn.date, &customer[i].lastTxn.month, &customer[i].lastTxn.year,
&customer[i].lastTxn.hr, &customer[i].lastTxn.min, &customer[i].lastTxn.sec);
Topic archived. No new replies allowed.