Liste des Groupes | Revenir à cl c |
On 01/01/2025 11:05, wij wrote:On Wed, 2025-01-01 at 01:29 -0800, Keith Thompson wrote:wij <wyniijj5@gmail.com> writes:In recent revision of libwy (a C++ library that wraps Clib functions), I feel
the so called 'graphics' can be a file descriptor.
A file *descriptor* is a small integer referring to some file-like
entity, used with open/close/read/write. There's no such thing in
standard C; it's a POSIX concept.
I don't think you're actually working with file descriptors, though it's
hard to tell.
if((r=popen(GrSvr,cpid,frd,fwr))!=Ok) {
WY_THROW(r);
}
popen() is a POSIX function. It takes two arguments, not four.
The code you posted is C++. Why are you posting it to comp.lang..c?
[...]
I would like to have opinions about the idea "graphics being a file descriptor".
The implement is irrevent for the discussion. Some imagination is required.
You'll need to explain what you mean by `graphics` or `'graphics`. What
is it now? What is it anyway?
Are you refering to the 'handles' that graphics libraries sometimes use
to refer to windows etc? If so what would be the advantages of having
them being file descriptors? Could those advantages be possible in any
other way?
How would it simplify your C++ code?
Some time ago, I had a scripting language where you could write:
print #x, "hello"
With x being either 'con' (the default if omitted), an open file handle,
a string destination, a printer or plotter handle, or the handle to an
image, window or control (button etc).
So this allowed you write text into any of those, via the convenience of
'print' which stringified or serialised many kinds of data, and also
kept track of the current text position.
Is this one of the advantages?
Actually I'm surprised that in Linux, everything isn't already a file
anyway.
Les messages affichés proviennent d'usenet.