I have this program and it suppose to read a file for an 52 char string. Then process the string. The y and n are use to process diffrent things I can't even get it read form the file right. It goes through the loop 12 time to get 5 lines of data. Is there easerway to get the info aout of the file then i'm using?
Latter on i need you use the n and y, but when i print the array out it does everthing 2 times( prints it twice, instead of 5 lines i get 10 lines of the same code) like there extra code when i put a for loop to print the first 31 char out.
here the file
YNYNYNYNYNYNYNYNYNYNYNYNYNYN1302 Coleridge Avenue
NYNYNYNYNYNYNYNYNYNYNYNYNYNYNY2311 Avenue A West
YYYYYNNNNNYYYYYNNNNNYYYYYNNNNN10656 Rondo Avenue
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN111 N. Montgomery Rd.
NNNNNYYYYYNNNNNYYYYYNNNNNYYYYYNE 53rd Street
here the code
char Apart , i ;
FILE *input_file ;
int counter = 1, n = 1 ;
/* If no file the give error */
if ( ( input_file = fopen( "i:\\c\\files\\Apts.dat", "r" ) ) == NULL )
fprintf(stderr,"The input file could not be opened.\n");
fgets(Apart, 52, input_file);
fclose (input_file); /* Close file */