hello. am new in this forum but i notice that u have dissucions about c so i am wondering if anyone can help me in doing an ATM program using file I/O. i know how to create a text file and use it but i dont know how to make it read one at a time. for example: this is my starting program.
#include <stdio.h>
int main()
{
FILE *customer_infor mation;
char pin_number[4]={101,102,103,1 04};
int test;
customer_inform ation=fopen("cu stomer_informat ion.txt","w");
if(customer_inf ormation==NULL)
{
puts("Error creating file");
return (1);
}
for(test=0;test <4;test++)
fprintf(custome r_information," %d\n",pin_numbe r[test]);
fclose(customer _information);
printf("Pin numbers:");
for(test=0;test <4;test++)
printf("\n%d\n" ,pin_number[test]);
return 0;
but i need this to read one number at a time like:
printf("Enter your pin number:");
the file contains: 101,102,103
but i need it to read just 101
#include <stdio.h>
int main()
{
FILE *customer_infor mation;
char pin_number[4]={101,102,103,1 04};
int test;
customer_inform ation=fopen("cu stomer_informat ion.txt","w");
if(customer_inf ormation==NULL)
{
puts("Error creating file");
return (1);
}
for(test=0;test <4;test++)
fprintf(custome r_information," %d\n",pin_numbe r[test]);
fclose(customer _information);
printf("Pin numbers:");
for(test=0;test <4;test++)
printf("\n%d\n" ,pin_number[test]);
return 0;
but i need this to read one number at a time like:
printf("Enter your pin number:");
the file contains: 101,102,103
but i need it to read just 101
Comment