C Ascii Art

Associate
Joined
28 Feb 2009
Posts
519
Is it possible to print ascii art in C? I want the code to print a Man but the character in the man count as control symbols is it possible to get the complie to ignore them?
 
I want to print this though
.---.
___ /_____\
/\.-`( '.' ) *BANG*
/ / \_-_/_
\ `-.-"`'V'//-.
`.__, |// , \
|Ll //Ll|\ \
|__// | \_\
/---|[]==| / /
\__/ | \/\/
/_ | Ll_\|
|`^"""^`|
| | |
| | |
| | |
| | |
L___l___J
|_ | _|
(___|___)
^^^ ^^^
I there away of saying print all the following characters!
 
Code:
printf(".---.\n");
printf("___ /_____\\ \n");
printf("/\\.-`( '.' ) *BANG*");

As you can see the characters used for escape sequences like \ need to be \\ to print as a \

You can do it all on one line by using a \n at an end of line to create a new line.

If you want to be adventurous you can stick your art in a file then open the file and print the contents to the console. Although you will still have to parse the contents for escape sequences and deal with them so they are displayed correctly.
 
If you want to be adventurous you can stick your art in a file then open the file and print the contents to the console. Although you will still have to parse the contents for escape sequences and deal with them so they are displayed correctly.

Hmm that sounds a lot easier. I think ill try that instead!
 
can you not just do this for each line

my_array[3] = {'\','-','/'}; // or whatever the chars are

printf(&my_array);

Sticking it in a file would be a lot easier as entering the formatted string is a pain when you can get it to convert the text string from the file to what it wants then print it out.

Plus can you do a printf like that? As it requires a const char * as the first argument followed by the values to insert into the format.
 
Plus can you do a printf like that? As it requires a const char * as the first argument followed by the values to insert into the format.

No, you can't.

25uiio7.png


Source: http://stev3.pastebin.com/KMfHyfGZ
 
Back
Top Bottom