Does C have grapgics or sound facilites? The only
mentions of graphics I
can find in K&R is defining structs for points, rectangles, etc. The only
mention of sound I can fidn is that \a produces a bell character.
But of course we all know you can write graphics and sound programs in C.
There will generally be libraries of functions to perform particular
operations (plot a point, draw a line, fill an area, etc). You call those
from your C program.
One advantage of languages like C is thst there are extendable. You can
have libraries of extra functuions that cna be used like hte built-in
functions of the language. The same applies to to many other languages
(forth being an obvious example).
C itself has NO I/O. That is corect. I/O is "ADDED" external
functions, NOT part of the language.
The compiler author will normally include some useful functions along with
the compiler. Those are called the "Standard Library". Typically, those
will include ones such as printf() to enable console output. Most of the
ones described in K&R will be included. They are NOT part of the
language, they are added functions. Market forces and competition have
forced compiler authors to all include all of the functions described in
K&R, and often many more, and besides the battles over interpretation of
the holy scriptures (remember when not everybody included a newline in
puts()?), they all end up with almost the same Standard Library functions.
BUT, "Standard Library" means the same as "Standard Equipment" when
you
are buying a car. It means what is generally supplied. "Standard",
inspite of it ending up that way, does NOT MEAN "standardized"!
Floor-mats, spare tire, etc. are always included in the "Standard
Equipment" when you buy a car, but that does NOT mean "standardized"!
Remember, that a "standard" is just a ten foot pole with a flag on top.
This is EXACTLY the situation where that matters. Graphics functions may
often be included in the "Standard Library" for a given compiler, or
included in one of the "standard" additional libraries of functions, that
are supplied. The functions supplied with Microsoft and Borland ended up
being virtually identical, but other compilers didn't feel that intensity
of competition.
DO NOT assume nor expect any standardization of graphics functions
between different platforms. In many cases, such as PC, the supplied
graphics functions are merely one-to-one mappings of direct calls to the
BIOS functions, but they MAY supply very sophisticated APIs.
In genral, BASICs were not extendable like that. It is
very difficult to
add new keywords ot a BASIC interpretter, and the way to do it is not
often docuemnted.
MICROS~1 BASIC typically has a somewhat awkward DEFUSR function in the
language to let you create and call machine language code. If you can
find them, there are commercial packages of machine language functions
for common tasks. Such as Brett Salter's "Peeks and Pokes".
On platforms with appropriate hardware (such as Coco, and even 5150),
MICROS~1 BASIC usually provided a usable set of graphics primitives, built
into their BASIC!, consisting of set-a-pixel and read-a-pixel, with some
minimal extensions, such as line draw.
--
Grumpy Ol' Fred cisin at
xenosoft.com