#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    3
    Rep Power
    0

    (C) Text Formatting in Console Apps?


    Hey, i was wondering if it is possible to, for example, colorize specific text in a win32 console app? Or rather, i'm pretty sure that it's possible, but how? = )

    Another side-question. Is it possible to create hash-tables, like in Java, in C? If so, i'd love to see how

    Thanks in advance
    -Simon
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    >> Hey, i was wondering if it is possible to, for example, colorize specific text in a win32 console app?

    You'd probably want the SetConsoleTextAttribute() function. See http://msdn.microsoft.com/library/de...tattribute.asp for documentation and code examples.

    >> Is it possible to create hash-tables, like in Java, in C?
    Yes, it is. There are third party libraries available that do just that. If you want to use C++, instead of C, you should look at the documentation for the Standard Template Library. Alternatively, if you wish to use MFC, you can use CStringList or inherit from CObList. See http://msdn.microsoft.com/library/de...3a.CObList.asp for more info.

    Happy reading :)
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    3
    Rep Power
    0
    Thanks a bunch! = )

    I were scared senseless at first glance at that function, but in the end, my n00b-app both received coloured text as well as a proper title. Yay!

    Now for those hash-tables! They should be a boon compared to the huge arrays currently in use. At one point, my exe ended up at 3.4 megs and it's really just a little app, all because of too big strings in too many arrays = )

IMN logo majestic logo threadwatch logo seochat tools logo