How come i dont work?

This is a discussion on How come i dont work? within the C++ Programming forums, part of the General Programming Boards category; Why doesn't gotoxy(x, y); work on dev c++? What other way can i do this?...

  1. #1
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    How come i dont work?

    Why doesn't
    gotoxy(x, y);
    work on dev c++?

    What other way can i do this?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    (because dev is crap [imho])

    try including conio.h
    though it isnt included in all versions of conio.h
    Monday - what a way to spend a seventh of your life

  3. #3
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    darnit

    Ok, i allways hate to admit, but im wrong, dev sux, i'll just use mvc++

    LOL

    I shoulda stayed with mvc++
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    gotoxy() is not supported in all compilers because it is not part of the standard. You could always read the FAQ and then you wouldn't have asked this question in the first place.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    75
    hmm... here is a bit of code i like to simplify this...
    with visual c++ this seems to work just fine.
    Take a look at the text_loc(x, y) in specific. it should function like goto(x,y)

    Code:
    #ifndef _CONSOLE_LIBRARY_INTERFACE
    #define _CONSOLE_LIBRARY_INTERFACE
    
    #include <windows.h>
    WORD cl_fc_param = 0;
    WORD cl_bc_param = 0;
    
    void text_color(bool red, bool green, bool blue, bool bright)
    {
        cl_fc_param = 0;
        if ( red ) cl_fc_param |= FOREGROUND_RED;
        if ( green ) cl_fc_param |= FOREGROUND_GREEN;
        if ( blue ) cl_fc_param |= FOREGROUND_BLUE;
        if ( bright ) cl_fc_param |= FOREGROUND_INTENSITY;
    
        SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), cl_fc_param|cl_bc_param );
    }
    void text_background(bool red, bool green, bool blue, bool bright)
    {
        cl_bc_param = 0;
        if ( red ) cl_bc_param |= BACKGROUND_RED;
        if ( green ) cl_bc_param |= BACKGROUND_GREEN;
        if ( blue ) cl_bc_param |= BACKGROUND_BLUE;
        if ( bright ) cl_bc_param |= BACKGROUND_INTENSITY;
    
        SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), cl_fc_param|cl_bc_param );
    }
    void text_loc(int x, int y)
    {
        COORD cursor_coordinates;
        cursor_coordinates.X = x;
        cursor_coordinates.Y = y;
        SetConsoleCursorPosition( GetStdHandle(STD_OUTPUT_HANDLE), cursor_coordinates );
    }
    
    void console_title(const char* title)
    {
        SetConsoleTitle(title);
    }
    
    #endif
    Last edited by genghis; 01-20-2002 at 11:42 PM.

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, 08:48 PM
  2. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 11:50 AM
  3. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 11:39 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  5. DLL __cdecl doesnt seem to work?
    By Xei in forum C++ Programming
    Replies: 6
    Last Post: 08-21-2002, 05:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21