int main(int argc, char **argv) { t_info_array board; t_pos_square result; char *file; char *line_file; char *map; board.nb_line = 0; board.nb_col = 0; board.array = NULL; if (argc == 1) my_putstr("Usage: ./bsq [FILE] "); file = fd(argv); line_file = line(file); board.nb_line = my_getnbr(line_file); free(line_file); map = maps(file); board.nb_col = my_col_nbr(map); board.array = get_array(map, board.nb_line, board.nb_col, 0); algo(&board, &result, 0, 0); modif_map(&board, &result); my_putchar_et(&board); free(file); return (0); }
void fill_map(t_map *info, FILE *fd) { Uint32 y; Uint32 x; int c; y = 0; rewind(fd); c = fgetc(fd); while (info->data[y] != NULL) { x = 0; while (x != info->x) { if (c != '\n' && c != EOF) { info->data[y][x] = c; c = fgetc(fd); } else info->data[y][x] = 0; x++; } c = fgetc(fd); y++; } modif_map(info); }