473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ANSI C screen manipulation?

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
Nov 13 '05 #1
5 3939

Fogus <no****@lacrymology.com> wrote in message
news:d1**************************@posting.google.c 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

Nov 13 '05 #2
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

Nov 13 '05 #3
> 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

Nov 13 '05 #4
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 (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 13 '05 #5
Mike Wahler <mk******@mkwahler.net> wrote in message
news:9G****************@newsread3.news.pas.earthli nk.net...

Fogus <no****@lacrymology.com> wrote in message
news:d1**************************@posting.google.c 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

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric Myers | last post by:
Hello folks: (This message is also posted on the help forum at the pexpect sourceforge page, but all indentation in the code got stripped away when I submitted the post.) For some time I've...
20
by: ritchie | last post by:
Hi, I am trying to clear the screen in my program. I am loking for something that will work on all compilers, especially Borland & MS Visual Studio 6. On Visual studio I used 'system("cls");'...
8
by: Kris Dugan | last post by:
I am using a Unix/Solaris 8/9 environment. I want to make a tool that will constantly read a structure of information and display that information (or "paint it") to the screen. Rather than...
2
by: Martín Marconcini | last post by:
Hello there, I'm writting (or trying to) a Console Application in C#. I has to be console. I remember back in the old days of Cobol (Unisys), Clipper and even Basic, I used to use a program...
5
by: Nadav | last post by:
Hi, I am trying to get a direct pointer to the address of the screen ( something like 0x0b00 in the happy DOS days ), how can I do that? Should this be done in the kernel or it can also be done...
48
by: Daniele C. | last post by:
As soon as my sourceforge.net project gets approved, I am going to build a ncurses port to win32 bindable to sockets, e.g. allowing VT100/ANSI terminals and the creation of simple terminal servers...
65
by: Leslie Kis-Adam | last post by:
Hi everyone! Does anyone know, if it is possible to clear the screen in ANSI C? If it is,then how? Any help would be appreciated. Laszlo Kis-Adam <dfighter_AT-NOSPAM_freemail.hu
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.