Thread: Is C dull?

  1. #1
    Registered User
    Join Date
    Jul 2003

    Is C dull?

    Hi, I havent tried programming in years, the last time i tried to learn was with turbo pascal. I remember the lessons were like making flashing backgrounds and changing text and background colours and making beeps with different pitches and stuff like that. So far all the tutorials on c I have found been concerned with text and numbers, can c do stuff with sound and colour as well and are there any tutorials for it or is that what direct x is for?

  2. #2
    Registered User
    Join Date
    Jun 2003
    The only thing your lessons taught you was how to change the colour and do stuff like this?
    ...just curious..
    ( Trying to be a good C Programmer )

  3. #3
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    It's OS dependent.
    Try this (it works on my linux console)
    #define FORE_BLACK 30
    #define FORE_RED 31
    #define FORE_GREEN 32
    #define FORE_YELLOW 33
    #define FORE_BLUE 34
    #define FORE_MAGENTA 35
    #define FORE_CYAN 36
    #define FORE_WHITE 37
    #define BACK_BLACK 40
    #define BACK_RED 41
    #define BACK_GREEN 42
    #define BACK_YELLOW 43
    #define BACK_BLUE 44
    #define BACK_MAGENTA 45
    #define BACK_CYAN 46
    #define BACK_WHITE 47
    static int textc=FORE_WHITE;
    void textcolor(int col)
    void backcolor(int col)
    // how to set text attribute such as blinking or inverse?
      printf("\033[0m normal \033[0m\n");
      printf("\033[5m blinking normal \033[0m\n");
      printf("\033[7m inverse \033[0m\n");
      printf("\033[7m\033[5m blinking inverse \033[0m\n");
      printf("\033[2m suppress \033[0m\n");
      printf("\033[1m bold \033[0m\n");
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

  4. #4
    Registered User
    Join Date
    Jul 2003
    Well it was back in highschool about 5 years ago, obviously we would have learnt other stuff but the only thing i remember clearly about it was a quiz game i wrote with flashing colours and beeps and stuff. I suppose they taught that first to try keep a room full of teenagers entertained without boring the sh$t out of them.

    .................................................. ....

    About the code above, i'm on windows xp with msvc++ and that code has no effect
    Thanks anyway, theres bound to be some info around somewhere

  5. #5
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    whats the point of just making beepy, flashing programs - i thought the idea of programming was to make useful aplications.
    If you havnt programmes for years, i dont recommend going straight for directX, go for vb to ease you bac in, then winapi, then shift to DX
    Monday - what a way to spend a seventh of your life

  6. #6
    Registered User
    Join Date
    Jul 2003
    Thanks for the advice iain, theres no point to the programs except for learning purposes, whats the point of hello world?
    I was just curious how c managed graphics and sound

  7. #7
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Hello world exists to teach you concepts.

    C/C++ handle graphics and sound through the use of APIs. Common ones (around here) include Allegro, SDL, WinAPI, DirectX, and OpenGL.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp returning 1...
    By Axel in forum C Programming
    Replies: 12
    Last Post: 09-08-2006, 07:48 PM
  2. Using fgets, removing last character
    By Stack Overflow in forum C Programming
    Replies: 31
    Last Post: 07-07-2004, 05:38 PM
  3. doubleanti's gender poll...
    By doubleanti in forum A Brief History of
    Replies: 111
    Last Post: 08-04-2002, 12:15 PM
  4. Encryption / File Shredding
    By DaRkHaCkErXx in forum C++ Programming
    Replies: 14
    Last Post: 05-05-2002, 06:17 PM