Answers for "how to ascii art in c"

C
0

how to ascii art in c

#include <stdio.h>
#define MAX_LEN 128
 
void print_image(FILE *fptr);
 
int main(void)
{
    char *filename = "image.txt";
    FILE *fptr = NULL;
 
    if((fptr = fopen(filename,"r")) == NULL)
    {
        fprintf(stderr,"error opening %s\n",filename);
        return 1;
    }
 
    print_image(fptr);
 
    fclose(fptr);
 
    return 0;
}
 
void print_image(FILE *fptr)
{
    char read_string[MAX_LEN];
 
    while(fgets(read_string,sizeof(read_string),fptr) != NULL)
        printf("%s",read_string);
}
Posted by: Guest on March-06-2020

Code answers related to "C"

Browse Popular Code Answers by Language