Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*============================================================================
- ----------------------------------------------------------------------------
- conColorEx.c - Console 'text' coloring example.
- (c) Damion 'Phr0z3n.Dev' Tapper, 2013.
- Email: Phr0z3n.Dev@Gmail.com
- NOTE: Save 'myColor.h' in the same location as this file.
- ----------------------------------------------------------------------------
- ============================================================================*/
- #define USE_SEC_API /* Comment this line if you do not have the secure libraries. */
- #include <stdio.h>
- #include <windows.h> /* For console coloring/manipulation functions. */
- #include "mycolor.h" /* For predefined color values. */
- int main(void)
- {
- #ifdef USE_SEC_API
- /* Predefined 'color-on-color' application. */
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), INTENSE_YELLOW_ON_BLUE);
- printf_s("Hello"); /* The secure printf function (good programming practice). */
- /* Bitwise predefined 'foreground-on-background' application. */
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_INTENSE_WHITE | FOREGROUND_INTENSE_MAGENTA);
- printf_s("'Unboring'");
- /* Bitwise predefined abbreviated 'foreground-on-background' application. */
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), B_RED | F_INTENSE_BLUE);
- printf_s("World!");
- #else
- /* If you are lacking the secure libraries. */
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), INTENSE_YELLOW_ON_BLUE);
- printf("Hello");
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_INTENSE_WHITE | FOREGROUND_INTENSE_MAGENTA);
- printf("'Unboring'");
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), B_RED | F_INTENSE_BLUE);
- printf("World!");
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement