Thread: Display ANSI graphics in C from TheDraw?

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    119

    Display ANSI graphics in C from TheDraw?

    I downloaded a program called TheDraw which is supposed to allow you to make ANSI graphics and export them to C and the like. Well, I exported something to C, and it printed some code that looked basically like what is in below, and I was wondering what to type to display it..... I tried printf("%s", KRIS); thinking that would work because it said "char KRIS []" so I figured that means it made a string array, right? I'm new to c, but I figured that would work, unfourtunatly, it didn't, so I'm wondering what does work?

    Thanks,
    ash


    Code:
    /* TheDraw C Screen Image.  Date: 12/28/05 */
    #define KRIS_WIDTH 80
    #define KRIS_DEPTH 25
    #define KRIS_LENGTH 4000
    unsigned char KRIS [] = {
        ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,
        ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F,
        ' ', 0x0F,  'H', 0x0F,  'i', 0x0F,  ' ', 0x0F,  ' ', 0x0F,  ' ', 0x0F};

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    KRIS is NOT a c null-terminated string that can be passed to printf() -- it has no 0 as the last byte. I think what that is doing is changing the color bytes on MS-DOS 6.X and earlier window. In MS-DOS 6.X and earlier, the window was 24 * 160 bytes (depending on the screen mode). Each character was represented by two bytes -- a byte that contained the ascii value and another adjacant byte with the color value.
    I don't think that will work on any version of MS-Windows console windows.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    119
    Quote Originally Posted by Ancient Dragon
    KRIS is NOT a c null-terminated string that can be passed to printf() -- it has no 0 as the last byte. I think what that is doing is changing the color bytes on MS-DOS 6.X and earlier window. In MS-DOS 6.X and earlier, the window was 24 * 160 bytes (depending on the screen mode). Each character was represented by two bytes -- a byte that contained the ascii value and another adjacant byte with the color value.
    I don't think that will work on any version of MS-Windows console windows.
    Thanks for the reply.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Turtle Graphics, how does it work?
    By freddyvorhees in forum C++ Programming
    Replies: 15
    Last Post: 08-28-2009, 09:57 AM
  2. Beginning Game Programming Type Books
    By bumfluff in forum Game Programming
    Replies: 36
    Last Post: 09-13-2006, 04:15 PM
  3. Graphics Programming :: Approach and Books
    By kuphryn in forum Windows Programming
    Replies: 4
    Last Post: 05-11-2004, 08:33 PM
  4. ANSI C Graphics programming
    By Xoid in forum C Programming
    Replies: 5
    Last Post: 03-31-2003, 12:33 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM