Just a little help please... :) ?
Hi
Here is a part of my code where I want to get input from file, now I did it and I'm getting the input from my file but I want to get rid of the user inputing his umm, input....(from keyboard...) :)
Thanks a lot !!!!
Code:
/*====================================================================*/
/* Function: Get_generation_0
* Purpose: Read in first generation
* Input args: number_of_rows, number_of_cols
* Input/output args: world_p
* Input: X's and blanks representing first generation
*/
void Get_generation_0(FILE* pSrc,world_t world, int number_of_rows,
int number_of_cols) {
int i, j;
char temp;
printf("Enter the first generation\n");
for (i = 0; i < number_of_rows; i++) {
j = 0;
fscanf(pSrc,"%c", &temp);
while ((temp != '\n') && (j < number_of_cols)) {
if (temp == PRINT_OCCUPIED)
world[i][j] = OCCUPIED;
j++;
fscanf(pSrc,"%c", &temp);
} /* while */
/* If the current character in temp isn't a newline, then
* there's garbage we need to skip over
*/
if (temp != '\n')
Skip_rest_of_line(pSrc);
} /* for */
} /* Get_generation_0 */