void display_start_end(t_lemin *l) { t_rooms *start; t_rooms *end; start = get_room_start(l); ft_putstr("##start\n"); ft_putstr(start->name); ft_putstr(" "); ft_putnbr(start->x); ft_putstr(" "); ft_putnbr(start->y); ft_putstr("\n"); end = get_room_end(l); ft_putstr("##end\n"); ft_putstr(end->name); ft_putstr(" "); ft_putnbr(end->x); ft_putstr(" "); ft_putnbr(end->y); ft_putstr("\n"); }
void play_round(t_heros *heros) { t_monster *monster; int enter; write (1, "auto-battling\n", 15); monster = malloc(sizeof(t_monster)); monster = create_monster(monster); ft_putstr(heros->name); write (1, " [", 2); ft_putnbr(heros->level); write (1, "][", 2); ft_putnbr(heros->xp); write (1, "] encounters a ", 15); ft_putstr(monster->name); write (1, "\n", 1); free (monster); write(1, "Press Enter", 11); enter = fgetc(fdopen(0, "r")); if (enter == 10) play_round(heros); }
void print_b(t_env *env) { int i; i = 0; while (i < env->stack_b_size) { ft_putnbr(env->stack_b[i]); ft_putchar(' '); i++; } ft_putchar('\n'); }
int ft_putpf_o(int nbr) { int ret; int i; ret = 0; i = nbr / 8; nbr = nbr % 8; if (i != 0) ret = ret + ft_putpf_o(i); ret = ret + ft_putnbr(nbr); return (ret); }
void affiche_arbre_rec(node *arbre) { if (arbre != NULL) { affiche_arbre_rec(arbre->left); if (arbre->left != NULL) { ft_putchar(','); } ft_putchar('['); ft_putnbr(arbre->id); ft_putchar(':'); ft_putnbr(arbre->data); ft_putchar(']'); //ft_putstr(" "); if (arbre->right != NULL) { ft_putchar(','); } affiche_arbre_rec(arbre->right); } }
void ft_print_int_matrix(int **imap, int vertices) { int i; int j; i = 0; while (i < vertices) { j = 0; ft_putnbr(i); ft_putstr(": "); while (j < vertices) { ft_putnbr(imap[i][j]); ft_putchar(' '); j++; } ft_putchar('\n'); i++; } ft_putendl("--------------"); }
void afficolle(int x, int y, int i, int n) { if (n != 0) write(1, " || ", 4); if (i == 0) write(1, "[colle-00] ", 11); if (i == 1) write(1, "[colle-01] ", 11); if (i == 2) write(1, "[colle-02] ", 11); if (i == 3) write(1, "[colle-03] ", 11); if (i == 4) write(1, "[colle-04] ", 11); ft_putchar('['); ft_putnbr(x); ft_putchar(']'); ft_putchar(' '); ft_putchar('['); ft_putnbr(y); ft_putchar(']'); }
void put_range(int *tab, int size) { int i; i = 0; while (i < size) { ft_putnbr(tab[i]); ft_putchar(' '); i++; } ft_putchar('\n'); }
void put_lst(t_lst **a) { t_lst *l; l = *a; while (l != NULL) { ft_putnbr(l->nbr); l = l->next; if (l != NULL) ft_putchar(' '); } }
void ft_put_int_list(t_list *lst) { t_list *tmp; tmp = lst; while (tmp) { ft_putnbr(*((int *)tmp->content)); ft_putstr("->"); tmp = tmp->next; } ft_putstr("null \n"); }
void ft_putnbr(int n) { if (n == -2147483648) ft_putstr("-2147483648"); else { if (n < 0) { ft_putchar('-'); n = -n; } if (n >= 10) { ft_putnbr(n / 10); ft_putnbr(n % 10); } else { ft_putchar(n + '0'); } } }
int main(int argc, char **argv) { int test; char **line; int fd; (void)argc; line = (char **)malloc(sizeof(char *) * 1); line[0] = ft_strdup("\0"); fd = open(argv[1], O_RDONLY); ft_putnbr(fd); ft_putchar('\n'); test = 1; while (test == 1) { test = get_next_line(fd, line); ft_putnbr(test); ft_putendl(line[0]); } free(line); return (0); }
void tetrimino_view(t_trimino *tetriminos) { t_trimino *lst; lst = tetriminos; while (lst) { tetrimino_print(lst); ft_putnbr(tetrimino_pos(lst)); lst = lst->next; } free(lst); }
int main() { int i; i = -2; while (i != 3) { ft_putnbr(ABS(i)); ft_putchar('\n'); i++; } return 0; }
static size_t file_size(int fd) { struct stat buf; int ret; ret = fstat(fd, &buf); if (ret == -1) return (0); ft_putstr("File size is "); ft_putnbr(buf.st_size); ft_putstr("\n"); return (buf.st_size); }
int main(int argc, char **argv ) { DIR *dir; struct dirent *sd; struct stat st; struct stat *statstr; int ret; t_list *lst; t_list *begin; int i; i = 0; ret = 1; begin = ft_lstnew(0, 0); while (++i < argc) { ret = lstat(argv[i], &st); if (ret == 0) { ft_putendl("ret = 0"); lst = ft_lstnew(&st, sizeof(st)); ft_lstadd(&begin, lst); } else { ft_putendl("ret = "); ft_putnbr(ret); ft_putendl(""); } } lst = begin; while (lst->next != NULL) { st = *(struct stat*)lst->content; ft_putnbr(st.st_size); lst = lst->next; } return (0); }
int main(void) { ft_putnbr(sizeof(int)); ft_putchar('\n'); ft_putnbr(sizeof(char)); ft_putchar('\n'); /* strnew */ ft_putendl("--- strnew ? --- "); char *str; str = ft_strnew(30); ft_putendl(str); /* strdel */ ft_putendl("--- strdel ? --- "); ft_memset(str, '8', 5); ft_putendl(str); str[1] = 'A'; ft_putendl(str); ft_strdel(&str); /* str[2] = 't'; ft_putendl(str); */ /* strsub */ ft_putendl("--- strsub ? --- "); ft_putendl(ft_strsub("hiyamina", 4, 4)); /* strjoin */ ft_putendl("--- strjoin ? --- "); ft_putendl(ft_strjoin("hello", "world")); /* strtrim */ ft_putendl("--- strtrim ? --- "); ft_putendl(ft_strtrim(" \n HELLOWORLD \n")); return (0); }
void print_reverse_tree(node *tree) { if (!tree) return ; if (tree->right) print_reverse_tree(tree->right); ft_putstr("Key ="); ft_putnbr(tree->key); ft_putstr("content = "); ft_putlst(tree->content); ft_putstr("\n"); if (tree->left) print_reverse_tree(tree->left); }
static void verb_sub(t_env *env, t_process *proc) { char *str; int len; str = ft_itoa(proc->num); len = ft_strlen(str); ft_putchar('P'); while (5 - len) { ft_putchar(' '); len++; } ft_putnbr(proc->num); ft_putstr(" | sub r"); ft_putnbr(ft_getnumber(env->arena, proc->pc + 2, 1)); ft_putstr(" r"); ft_putnbr(ft_getnumber(env->arena, proc->pc + 3, 1)); ft_putstr(" r"); ft_putnbr(ft_getnumber(env->arena, proc->pc + 4, 1)); ft_putchar('\n'); free(str); }
void print_error(char *logname, char *pwd, char *home) { if (g_handler.cmd == 0) ft_putstr("\033[m\033[32m"); else { ft_putstr("\033[m\033[31m "); ft_putnbr(g_handler.cmd); } ft_putstr(" ~> \033[m"); ft_strdel(&home); ft_strdel(&logname); ft_strdel(&pwd); }
void exit_on_glerror(const char *error_message) { GLenum error; error = glGetError(); if (error != GL_NO_ERROR) { ft_putstr(error_message); ft_putstr(": [code="); ft_putnbr(error); ft_putendl("]"); exit(EXIT_FAILURE); } }
void ft_putnbr(int n) { unsigned int nb; unsigned int temp; if (n < 0) { nb = -n; write(1, "-", 1); } else nb = n; if (nb < 10) { temp = nb + '0'; write(1, &temp, 1); } else { ft_putnbr(nb / 10); ft_putnbr(nb % 10); } }
void ft_putnbr(int n) { long aux; aux = n; if (aux < 0) { aux *= -1; ft_putchar('-'); } if (aux > 9) ft_putnbr(aux / 10); ft_putchar(aux % 10 + '0'); }
void ft_putnbr(int nb) { long n; n = (long)nb; if (n < 0) { ft_putchar('-'); n = -n; } if (n > 9) ft_putnbr(n / 10); ft_putchar((int)(n % 10 + '0')); }
void key_put(t_key const key) { t_ui i; i = 0; while (i < KEYCODE_SIZE) { if (i > 0) ft_putstr(" - "); ft_putnbr(key[i]); ++i; } ft_putchar('\n'); }
void ft_puttab(t_grid *grid) { int i; int j; i = 0; j = 0; while (i < grid->columns) { j = 0; while (j <= grid->table[i][0]) { ft_putnbr(grid->table[i][j]); ft_putchar(' '); j++; } ft_putchar('\n'); i++; } ft_putstr("Nb lines : "); ft_putnbr(grid->columns); ft_putchar('\n'); }
void print_mins(t_car_list *temp) { if ((g_flag & OPT_MINS) == OPT_MINS && (g_flag & OPT_A) != OPT_A && temp->name[0] != '.') { ft_putstr(space(nb_ch(temp->blocks), g_max[5])); ft_putnbr(temp->blocks); ft_putstr(" "); } else if ((g_flag & OPT_MINS) == OPT_MINS && (g_flag & OPT_MAJA) == OPT_MAJA && ft_strcmp(temp->name, ".") != 0 && ft_strcmp(temp->name, "..") != 0) { ft_putstr(space(nb_ch(temp->blocks), g_max[5])); ft_putnbr(temp->blocks); ft_putstr(" "); } else if ((g_flag & OPT_MINS) == OPT_MINS && (g_flag & OPT_A) == OPT_A) { ft_putstr(space(nb_ch(temp->blocks), g_max[5])); ft_putnbr(temp->blocks); ft_putstr(" "); } }
void ft_display_tab(int **tab, int line, int col) { int i; int j; i = 0; j = 0; while (i < line) { j = 0; ft_putstr("ligne "); ft_putnbr(i); ft_putstr(": "); while (j < col) { ft_putnbr(tab[i][j]); ft_putchar(' '); j++; } ft_putchar('\n'); i++; } }
void ft_putnbr(int n) { if (n == -2147483648) { ft_putstr("-2147483648"); return ; } if (n < 0) { write(1, "-", 1); n = 0 - n; } if (n > 9) { ft_putnbr(n / 10); ft_putnbr(n % 10); } else { n += 48; write(1, &n, 1); } }
void ft_putnbrendl(int n) { if (n == -2147483648) ft_putstr("-2147483648"); else if (n == 2147483647) ft_putstr("2147483647"); else { if (n < 0) { ft_putchar('-'); n *= -1; } if (n < 10) ft_putchar('0' + n); else { ft_putnbr(n / 10); ft_putnbr(n % 10); } } ft_putchar('\n'); }