Deutsch English Français Italiano |
<54e61867ce60b955e70510b0cb3433b910c87550.camel@gmail.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: wij <wyniijj5@gmail.com> Newsgroups: comp.lang.c Subject: Re: Can 'graphics' be a file descriptor? Date: Wed, 01 Jan 2025 21:40:21 +0800 Organization: A noiseless patient Spider Lines: 86 Message-ID: <54e61867ce60b955e70510b0cb3433b910c87550.camel@gmail.com> References: <d0fcbe9e7b29ce6f9a0604058475b0aa9a23d5cb.camel@gmail.com> <87msgaubjj.fsf@nosuchdomain.example.com> <0bfa49a6d580546ab2db91aeac7627afb19e492d.camel@gmail.com> <vl3b5b$2ot7p$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Date: Wed, 01 Jan 2025 14:40:23 +0100 (CET) Injection-Info: dont-email.me; posting-host="07e9084d35e98e2c9c23b4b63e81553f"; logging-data="2934392"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bXvj7Hg2o4AOw5EAfEliM" User-Agent: Evolution 3.54.2 (3.54.2-1.fc41) Cancel-Lock: sha1:p63KtAfRpxdfTayOypzJ1t1OUq4= In-Reply-To: <vl3b5b$2ot7p$1@dont-email.me> Bytes: 4307 On Wed, 2025-01-01 at 12:07 +0000, bart wrote: > 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 function= s), I feel > > > > the so called 'graphics' can be a file descriptor. > > >=20 > > > A file *descriptor* is a small integer referring to some file-like > > > entity, used with open/close/read/write.=C2=A0 There's no such thing = in > > > standard C; it's a POSIX concept. > > >=20 > > > I don't think you're actually working with file descriptors, though i= t's > > > hard to tell. > > >=20 > > > > =C2=A0=C2=A0 if((r=3Dpopen(GrSvr,cpid,frd,fwr))!=3DOk) { > > > > =C2=A0=C2=A0=C2=A0=C2=A0 WY_THROW(r); > > > > =C2=A0=C2=A0 } > > >=20 > > > popen() is a POSIX function.=C2=A0 It takes two arguments, not four. > > >=20 > > > The code you posted is C++.=C2=A0 Why are you posting it to comp.lang= ..c? > > >=20 > > > [...] > >=20 > > I would like to have opinions about the idea "graphics being a file des= criptor". > > The implement is irrevent for the discussion. Some imagination is requi= red. > >=20 >=20 > You'll need to explain what you mean by `graphics` or `'graphics`. What= =20 > is it now? What is it anyway? >=20 > Are you refering to the 'handles' that graphics libraries sometimes use= =20 > to refer to windows etc? If so what would be the advantages of having=20 > them being file descriptors? Could those advantages be possible in any= =20 > other way? >=20 > How would it simplify your C++ code? Yes, in MS-Windonw, file descriptor is probably still 'file handle' (as in = DOS). I am mainly referring to Linux (or systems that relies on file descriptor). The usual graphics library, especially with GUI,... seriously interfere the the 'normal' program. E.g. you are not expected to have a clean source prog= ram=20 that simply edits a picture file. > Some time ago, I had a scripting language where you could write: >=20 > =C2=A0=C2=A0=C2=A0 print #x, "hello" >=20 > With x being either 'con' (the default if omitted), an open file handle,= =20 > a string destination, a printer or plotter handle, or the handle to an= =20 > image, window or control (button etc). >=20 > So this allowed you write text into any of those, via the convenience of= =20 > 'print' which stringified or serialised many kinds of data, and also=20 > kept track of the current text position. >=20 > Is this one of the advantages? Yes, looked like what I expect. But file descriptor is a stronger request (= or provision) than library codes. It will simply more and would standardize 'graphics' to some extent enough for 'normal programs' (commercial programs alway seek breakthrough, you cannot expect to fully standardize it). Are there any problem doing 'graphics' with your print script? I am mainly looking for 'clean'/reusabe source code. > Actually I'm surprised that in Linux, everything isn't already a file=20 > anyway. ??? to my knowledge, in Linux 'everything' is file descriptor.