/******************************************** combines ASCII art files with textual content fi5e 04_20_04 forgive my code...... *********************************************/ #include using namespace std; #include #include int main(void) { //initialze variables char ch; char space; FILE * fp; FILE * sv; int tot_count1, tot_count2, count1, count2, count3; int i; int space_count; //stores names of files to open char file1[30]; char file2[30]; char file3[30]; //stores new arrays w/o " " and "\n" char image[6000000]; char content[600000]; //character print test //for(i=0; i<275; i++){ //printf("int %d = char %c\n", i, i); //} /***************************************************** WELCOME SCREEN*/ printf(" ÛÛÛÛ ÛÛÛÛ\n"); printf(" ÛÛ Û\n"); printf("ÛÛÛÛÛ ÛÛ Û\n"); printf(" ÛÛÛ ÛÛ Û\n"); printf("Û Û ÛÛ Û\n"); printf("ÛÛÛÛÛÛ ÛÛ ÛÛ\n"); printf("\n"); printf(" ÛÛ\n"); printf(" ÛÛ\n"); printf(" ÛÛÛÛ ÛÛÛ ÛÛÛÛÛÛÛ Û Û\n"); printf(" Û ÛÛ Û ÛÛ ÛÛ\n"); printf("ÛÛ ÛÛ Û Û Û\n"); printf(" Û ÛÛ Û ÛÛ\n"); printf(" ÛÛÛÛ ÛÛ ÛÛÛ ÛÛ\n"); printf(" ÛÛÛ\n"); printf(" ÛÛ ÛÛÛÛ\n"); printf(" Û\n"); printf(" ÛÛÛÛÛÛ ÛÛÛÛÛ Û ÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛ Û\n"); printf("ÛÛ Û Û Û Û ÛÛ Û ÛÛ ÛÛ Û\n"); printf("ÛÛ Û Û Û Û ÛÛ Û ÛÛ ÛÛ Û\n"); printf(" ÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ ÛÛ Û ÛÛÛÛÛ ÛÛ Û\n"); printf("All City Council Ver. 1.0\n"); printf("by fi5e\n"); printf("\n"); //get two files from user printf("Enter the name of the .txt file containing readable content.\n"); scanf("%s", file1); printf("Enter the name of the ASCII art text file.\n"); scanf("%s", file2); //set counters to 0 tot_count1 = 0; tot_count2 = 0; count1 = 0; count2 = 0; count3 = 0; space_count = 0; space = ':'; //load data from txt file fp = fopen(file1, "r"); ch = getc(fp); while (ch != EOF) { //if char is character or a space enter if statement if(ch != '\n' && ch != '\t'){ //if the char is a space only show one if(ch == ' ' && (space_count == 0)){ //show space a ¤ character content[count1] = space; space_count++; count1++; //printf("space count == %c\n", space); } if(ch != ' '){ content[count1] = ch; count1++; space_count = 0; //printf("non print char = %c\n", ch); //putchar(ch); } } //putchar(ch); //this will print file1 to screen ch = getc(fp); tot_count1++; } //print info to screen printf("\n"); printf("There are %d total characters in %s\n", tot_count1, file1); printf("There are %d non space and non newline characters in %s\n", count1, file1); //scanf("%s", file1); //prints file2 fp = fopen(file2, "r"); ch = getc(fp); while (ch != EOF) { //check for spaces and newlines if(ch != '\n' && ch != ' '){ //image[count2]; count2++; } //putchar(ch); image[tot_count2] = ch; //printf("%c", image[tot_count2]); ch = getc(fp); tot_count2++; } printf("\n"); printf("There are %d total characters in %s\n", tot_count2, file2); printf("There are %d non space and non newline characters in %s\n\n", count2, file2); //enter file name to save printf("Enter name of new file to create (should end in .txt)\n"); scanf("%s", file3); sv = fopen(file3, "w"); //count1 = 0; printf("tot_count2 = %d\n", tot_count2); //for(i=0; i<20; i++){ //putc('a', sv); //} for(i=0; icount1){ count3 = 0; } } } //close all files fclose(fp); fclose(sv); return 0; }