graphics functions under unix...

D

Derk Gwen

(e-mail address removed) (ehab) wrote:
# How can I use the graphics functions with gcc such as box,palette,color.

Every unix should have a library called _curses_ which is a very old windowing
system that runs inside a terminal window. For modern bit mapped graphics,
you can use _X-Windows_. Some unices have other windowings, like MacOSX Aqua.
 
M

Malcolm

ehab said:
How can I use the graphics functions with gcc such as
box,palette,color.
You need a non-standard library. The first thing to do is determine which
non-standard libraries are available on your system - if you have a GUI then
almost certainly some sort of graphics capability will be provided.

In your source you then #include the headers (non-standard) needed for that
library, and then call the functions as directed in the documentation.

Then you need to link the library at link time. This may be done
automatically, or it may be necessary to specify this directly to the
compiler, using an option like -l.
 
L

Logan Shaw

You need a non-standard library.

If by non-standard, you mean something that gcc doesn't link in
by default, then yes. But if by non-standard, you mean some
third-party library, you don't really need that. You can do
all of the above with libX11, right? Windows, lines, rectangles,
colors, etc. It's probably not the best library to use for
a real application (with buttons, menus, etc.), but it might
not be bad for some experimentation and learning.

- Logan
 
M

Martin Dickopp

Logan Shaw said:
If by non-standard, you mean something that gcc doesn't link in by
default, then yes. But if by non-standard, you mean some third-party
library, you don't really need that. You can do all of the above with
libX11, right?

I don't know in which of the five newsgroups Malcolm read the original post,
but "here" in comp.lang.c, everything not defined by the ISO C standard is
cosidered non-standard. Therefore, libX11 *is* non-standard in the context
of comp.lang.c.

That said, I think it is in fact possible to write a strictly conforming C
program which opens windows, draws buttons and menus, etc., on an X server.
Just implement the X protocol, and run the program in such a way that
standard input and standard output are network connections to the X server.
;)

Martin
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top