Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > ANSI C screen manipulation?

Reply
Thread Tools

ANSI C screen manipulation?

 
 
Fogus
Guest
Posts: n/a
 
      08-21-2003
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
 
Reply With Quote
 
 
 
 
Mike Wahler
Guest
Posts: n/a
 
      08-21-2003

Fogus <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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



 
Reply With Quote
 
 
 
 
Thomas Matthews
Guest
Posts: n/a
 
      08-21-2003
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

 
Reply With Quote
 
Nudge
Guest
Posts: n/a
 
      08-21-2003
> 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

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      08-21-2003
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 ((E-Mail Removed)) ((E-Mail Removed))
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

 
Reply With Quote
 
Mike Wahler
Guest
Posts: n/a
 
      08-21-2003
Mike Wahler <(E-Mail Removed)> wrote in message
news:9G61b.2450$(E-Mail Removed) nk.net...
>
> Fogus <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
> > 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pre-ansi to ansi c++ conversion? Frank Iannarilli C++ 2 07-21-2009 11:05 PM
Are there statistics packages in ANSI C and/or ANSI C++? lbrtchx@gmail.com C Programming 11 04-28-2008 03:00 AM
Are there statistics packages in ANSI C and/or ANSI C++? lbrtchx@gmail.com C++ 1 04-24-2008 06:44 PM
screen clearing in ANSI C Leslie Kis-Adam C Programming 65 12-02-2006 03:00 AM
ANSI clear screen [MS & Borland] ritchie C Programming 20 12-11-2003 05:30 PM



Advertisments