Need help with compiler

This is a discussion on Need help with compiler within the C Programming forums, part of the General Programming Boards category; Urgent need of a 64 bit compiler for windows 7 which supports borland extentions like clrscr() , getch() and gotoxy()....

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    32

    Exclamation Need help with compiler

    Urgent need of a 64 bit compiler for windows 7 which supports borland extentions like clrscr() , getch() and gotoxy().
    Last edited by Dr.Xperience; 10-19-2010 at 09:56 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,822
    You asked already
    C Compiler For 64-Bit Windows 7

    This is your university's problem, not ours.

    What are your fellow students using?

    > which supports borland extentions like clrscr() and getch().
    Another worrying sign that they're stuck in the past.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    32
    No it would be improper to say that university is stuck in past. Just we are going through thorough analysis of C from Basic to Advance . I am just stuck because of these stuff.

    Ok... Then do you have any alternative for these functions clrscr() and getch() and gotoxy().

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,001
    You really don't need the functionality you're asking for, methinks. If the university requires it, then it's struck in the past.
    If you're just going to learn C, then there is no need to do anything fancy.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    The functionality you want is available through the Windows API, but it is NOT as easy to use as Borland's extensions.

    Here's how to use Gotoxy (actually SetConsoleCursorPosition(), ).

    Code:
    /* shows how to use SetConsoleCursorPosition(), in Windows */
    
    #include <stdio.h>
    #include <windows.h>
    
    void Gotoxy(int x, int y); 
    void showIt(void);
    
    int main(void) {
      showIt();
    
      printf("\n\n\t\t\t    press enter when ready");
      (void) getchar();
      return 0;
    }
    
    void Gotoxy(int x, int y) {
       COORD coord;
       coord.X = x;
       coord.Y = y;
       SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
    }
    void showIt(void)  {
       Gotoxy(1,5);
      putchar('*');
    }
    Done in this way, SetConsoleCursorPosition() works just like gotoxy(), in Turbo C, except for the capital G.

    The MSDN library has all the info on these API calls.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,822
    The fact that you're clinging to obsolete functions like clrscr() , getch() and gotoxy(), like they're some security blanket means you're stuck in the past.

    If you're learning standard C (which is the only thing any respectable institution should be teaching), then you have no need for these functions.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Salem, you don't like SetConsoleCursorPosition() in the API?

    I use it (or gotoxy() if it's on turbo C), a LOT for my little games and puzzles. I've avoided working with the video buffer, because I thought the addresse or dimension of it, would change from one video card, to the other.

    What would you suggest, instead?

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,822
    Why would it be necessary?

    And what if you're on an OS that isn't windows?

    Students NEED to learn how to program, and learn standard C, before getting all confused with OS/Compiler specific API calls.

    Otherwise they get all confused and ask "stupid" questions like "why doesn't codemuncher 2.0 support gotoxy".
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I have to move small objects a lot in my little programs - games, puzzles. The placement is an essential part of the game. No way can I redraw the whole screen without flicker.

    I accept that Windows programs will not run on Linux, as is. If Wine or some virtual Windows, won't do the job, then it can't be done with the same code.

  10. #10
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195
    I have to admit, I find Salem's cynicism very funny, and in part I agree with him that if you are learning the ANSI C, you shouldn't be bothering with OS specific APIs. However, the window's API does have a few handy functions if you want to make some basic console computer games, even if they aren't portable.

    As a challenge (not a particularly hard challenge, I admit), the university could ask the students to write their own cross-platform functions for gotoxy() etc. Ofcourse, the other side of the coin is that it could be seen as a waste of time if these functions already exist, even if they are platform specific, after all, why reinvent the wheel?

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,001
    Is this a course about ISO C or Windows? Ask yourself that. If it's about ISO C, then there is no reason to use gotoxy, et all. If you need to be writing games or whatnot, then you should be looking into APIs.
    Also, we don't really learn/teach ANSI C anymore. Those who do should be fired. One upon a time, there was ANSI C. That is no longer the case. The future is ISO C (as far as C is concerned).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Registered User
    Join Date
    Sep 2010
    Posts
    32
    I understood........ No solution for my problem.
    Huh.... I guess I have to try in different way.
    Probably I have to begin from scratch.
    Anyway thank you everyone.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 05:04 AM
  2. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 12:07 PM
  3. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  4. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM
  5. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 10:08 PM

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