ANSI C screen manipulation?

Discussion in 'C Programming' started by Fogus, Aug 21, 2003.

  1. Fogus

    Fogus Guest

    I have written a portable chess program using ANSI C, however at the
    moment my 'console' display is quite ugly. It currently uses rote
    printfs to output a page at a time of the board as well as other
    useful information. These pages simply scroll one after the other.
    However, in reality a better solution would be to (at minimum) clear
    the screen (or a portion thereof) before displaying the next page.
    However, I want portability and therefore do not want to rely on
    system calls or non-standard libs such as curses. Are there common
    implementations available that I may have missed?

    Thank you in advance.
    -m
    Fogus, Aug 21, 2003
    #1
    1. Advertising

  2. Fogus

    Mike Wahler Guest

    Fogus <> wrote in message
    news:...
    > I have written a portable chess program using ANSI C, however at the
    > moment my 'console' display is quite ugly. It currently uses rote
    > printfs to output a page at a time of the board as well as other
    > useful information. These pages simply scroll one after the other.
    > However, in reality a better solution would be to (at minimum) clear
    > the screen (or a portion thereof) before displaying the next page.
    > However, I want portability and therefore do not want to rely on
    > system calls or non-standard libs such as curses. Are there common
    > implementations available that I may have missed?


    There are many implementations, all of which are platform-dependent.
    Standard C does not have any inherent support for video displays,
    or any other hardware device. You'll need a platform-specific
    solution. If you intend to port the code, then isolate this part,
    so it can be easily be replaced with code specific to the
    other platforms.

    -Mike
    Mike Wahler, Aug 21, 2003
    #2
    1. Advertising

  3. Fogus wrote:
    > I have written a portable chess program using ANSI C, however at the
    > moment my 'console' display is quite ugly. It currently uses rote
    > printfs to output a page at a time of the board as well as other
    > useful information. These pages simply scroll one after the other.
    > However, in reality a better solution would be to (at minimum) clear
    > the screen (or a portion thereof) before displaying the next page.
    > However, I want portability and therefore do not want to rely on
    > system calls or non-standard libs such as curses. Are there common
    > implementations available that I may have missed?
    >
    > Thank you in advance.
    > -m


    There are no common functions for manipulating cursors or screens
    since not every platform has a screen and those that do have
    different methods for handling them.

    You could build yourself a interface of functions available on
    your target platforms. Create a library for each platform that
    uses system specific features. Link in a different library
    based upon the target platform.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    Thomas Matthews, Aug 21, 2003
    #3
  4. Fogus

    Nudge Guest

    > I have written a portable chess program using ANSI C, however at
    > the moment my 'console' display is quite ugly. It currently uses
    > rote printfs to output a page at a time of the board as well as
    > other useful information. These pages simply scroll one after
    > the other. However, in reality a better solution would be to (at
    > minimum) clear the screen (or a portion thereof) before
    > displaying the next page. However, I want portability and
    > therefore do not want to rely on system calls or non-standard
    > libs such as curses. Are there common implementations available
    > that I may have missed?


    Your question seems close to FAQ 19.4
    http://www.eskimo.com/~scs/c-faq/q19.4.html
    Nudge, Aug 21, 2003
    #4
  5. Fogus

    CBFalconer Guest

    Fogus wrote:
    >
    > I have written a portable chess program using ANSI C, however at the
    > moment my 'console' display is quite ugly. It currently uses rote
    > printfs to output a page at a time of the board as well as other
    > useful information. These pages simply scroll one after the other.
    > However, in reality a better solution would be to (at minimum) clear
    > the screen (or a portion thereof) before displaying the next page.
    > However, I want portability and therefore do not want to rely on
    > system calls or non-standard libs such as curses. Are there common
    > implementations available that I may have missed?


    Not in portable standard C. Congratulations on building a
    portable system. You can now supply non-portable alternatives by
    isolating those output routines in a file, and writing custom
    replacements for particular systems.

    --
    Chuck F () ()
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net> USE worldnet address!
    CBFalconer, Aug 21, 2003
    #5
  6. Fogus

    Mike Wahler Guest

    Re: [P.S.] ANSI C screen manipulation?

    Mike Wahler <> wrote in message
    news:9G61b.2450$...
    >
    > Fogus <> wrote in message
    > news:...
    > > I have written a portable chess program using ANSI C,


    I've always been interested in chess and computer chess
    programs. May I see your code? (if it's very large, you could
    post it on the web and send a link, or email me directly.)

    If you'd rather not share it, I understand, and thanks anyway.

    -Mike
    Mike Wahler, Aug 21, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ritchie

    ANSI clear screen [MS & Borland]

    ritchie, Dec 6, 2003, in forum: C Programming
    Replies:
    20
    Views:
    3,805
    CBFalconer
    Dec 11, 2003
  2. Leslie Kis-Adam

    screen clearing in ANSI C

    Leslie Kis-Adam, Nov 24, 2006, in forum: C Programming
    Replies:
    65
    Views:
    9,400
    Leslie Kis-Adam
    Dec 2, 2006
  3. Replies:
    1
    Views:
    481
  4. Replies:
    11
    Views:
    1,067
    Keith Thompson
    Apr 28, 2008
  5. Frank Iannarilli

    pre-ansi to ansi c++ conversion?

    Frank Iannarilli, Jul 21, 2009, in forum: C++
    Replies:
    2
    Views:
    410
Loading...

Share This Page