Skip to content

Commit

Permalink
added c corner ascii art (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
balaji-sivasakthi authored Mar 11, 2024
1 parent e6495ed commit e07df5a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 13 deletions.
6 changes: 6 additions & 0 deletions logo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
______ ______ ______ ______ __ __ ______ ______
/\ ___\ /\ ___\ /\ __ \ /\ == \ /\ "-.\ \ /\ ___\ /\ == \
\ \ \____ \ \ \____\ \ \/\ \\ \ __< \ \ \-. \\ \ __\ \ \ __<
\ \_____\ \ \_____\\ \_____\\ \_\ \_\\ \_\\"\_\\ \_____\\ \_\ \_\
\/_____/ \/_____/ \/_____/ \/_/ /_/ \/_/ \/_/ \/_____/ \/_/ /_/

65 changes: 52 additions & 13 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,55 @@
#include<stdio.h>
#include "linked-list/linked_list.h"
#include <stdio.h>
#include <stdlib.h>

#define MAX_LEN 1024

void print_image(FILE *fptr);
void change_foreground_blue();
void change_foreground_red();
void change_foreground_yellow();
void change_foreground_green();
void reset();

int main(){
struct Node* head = NULL;
// insert data in the linked list
insert_data(&head, 1);
insert_data(&head, 2);
insert_data(&head, 3);
insert_data(&head, 4);
insert_data(&head, 5);
insert_data(&head, 6);
insert_data(&head, 7);
// print linked list
print_list(head);
char *filename = "logo.txt";
FILE *fptr = NULL;
change_foreground_green();
printf("=====================================================================\n");
if((fptr = fopen(filename,"r")) == NULL)
{
fprintf(stderr,"error opening %s\n",filename);
return 1;
}
print_image(fptr);
fclose(fptr);
printf("=====================================================================\n");
return 0;
}

void change_foreground_blue(){
printf("\033[0;34m");
}

void change_foreground_yellow(){
printf("\033[0;33m");
}

void change_foreground_red(){
printf("\033[0;31m");
}

void change_foreground_green(){
printf("\033[0;32m");
}

void reset(){
printf("\033[0m");
}

void print_image(FILE *fptr) {
char read_string[MAX_LEN];
while(fgets(read_string, sizeof(read_string), fptr) != NULL) {
printf("%s", read_string);
}
printf("\n");
}

0 comments on commit e07df5a

Please sign in to comment.