main.c
/*
 * Function: print
 * ---------------
 * Prints the current state of the board into a given file
 *
 */
print

Prints the current state of the board into a given file
print Prints the current state of the board into a given file
int print(const char * screen_path) {
    FILE * fp_screen = fopen(screen_path, "w");
    if (fp_screen == NULL) {
        printf("Couldn't create / open file at path \"%s\"\n", screen_path);
        return CANNOT_OPEN_SCREEN_FILE;
    }
    int x, y;
    for (y = 1; y <= BOARD_SIZE; y++) {
        for (x = 1; x <= BOARD_SIZE; x++) {
            char * key = board[y][x] == 1 ? "\u2588\u2588" : "\u2591\u2591";
            fputs(key, fp_screen);
        }
        fputc('\n', fp_screen);
    }
    if (0 != fclose(fp_screen)) {
        printf("Couldn't close file \"%s\"\n", screen_path);
        return CANNOT_CLOSE_SCREEN_FILE;
    }
    return 0;
}
int print ( const char * screen_path ) { FILE * fp_screen = fopen ( screen_path , " " ) ; if ( fp_screen == NULL ) { printf ( " \" \" \n " , screen_path ) ; return CANNOT_OPEN_SCREEN_FILE ; } int x , y ; for ( y = 1 ; y <= BOARD_SIZE ; y ++ ) { for ( x = 1 ; x <= BOARD_SIZE ; x ++ ) { char * key = board [ y ] [ x ] == 1 ? " \u2588 \u2588 " : " \u2591 \u2591 " ; fputs ( key , fp_screen ) ; } fputc ( ' \n ' , fp_screen ) ; } if ( 0 != fclose ( fp_screen ) ) { printf ( " \" \" \n " , screen_path ) ; return CANNOT_CLOSE_SCREEN_FILE ; } return 0 ; }
Function: print
Function : print