Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: stdin and stdout |
| Date | 2015-07-22 13:19 -0500 |
| Organization | albasani.net |
| Message-ID | <moon32$2t6$1@news.albasani.net> (permalink) |
| References | (2 earlier) <mojf3u$q45$1@dont-email.me> <mom1be$vvl$1@news.albasani.net> <mom7ld$7vq$1@dont-email.me> <mon8ih$agl$1@news.albasani.net> <6d37b324-765e-45f7-959b-d1d77c647b4f@googlegroups.com> |
On 7/22/2015 4:48 AM, Rick C. Hodgin wrote:
> Bart,
>
> Would GetStdHandle() work?
>
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms683231(v=VS.85).aspx
>
for doing console IO? yes.
for getting FILE* pointers that work with the C library? no.
it is like using OpenFile(or CreateFile) / ReadFile(or ReadFileEx), or
open/read, instead of fopen/fread.
though, granted, in my case I tend to prefer using wrappers and/or a VFS
layer, which will typically mimic stdio, but generally uses OS-specific
interfaces in the background, or if-needed falls back to stdio, via
preprocessor magic.
if quick and dirty, the IO wrappers may simply forward to stdio.
this is still much more flexible than using stdio directly.
for example, it isn't hard to use a single VFS over the entire
application, and allows plugging in VFS "drivers" which may provide
specialized filesystem types (say, much of the filesystem contents can
be "mounted" from ZIP files or similar), as well as being able to gloss
over OS differences.
in my older (main) codebase, a VFS structure was used:
foo/bar, may be a relative path, if a 'context' is used
otherwise an 'absolute' virtual path.
/foo/bar, absolute virtual path.
//foo/bar, Linux special case, means OS absolute path.
X:/foo/bar, used for "external" paths.
A:/ .. Z:/, Win32 absolute path.
also used for HTTP and FTP VFS drivers (as URLs).
there is also a VFS-level mechanism for aliasing, which is basically
something between a mount and a symlink. there isn't currently a "good"
mechanism for VFS level symlinks. there is currently a crude mechanism
for symlinks (via special files holding the target path), but isn't
really all that well-done or transparent (need to fix up handling of
both symlinks and file permissions and async IO)
I could possibly do a redesigned VFS later, mostly doing some internal
design cleanup and addressing some internal design flaws. dunno.
current VFS goes back to 2004, which had largely redesigned a VFS I had
been using since the late 90s, which came about mostly because I had
wanted to lazily abstract over stdio, so just took all the stdio calls
and put a V on the front, so: "VFILE" and "vfread()", with some newer
calls doing more like "VfWhatever()", could possibly go more over to
this later convention, as well as providing a defined 'object' interface.
ex (possibly):
VfRead(buf, s1, s2, fd); //API function call
can also be done as:
(*fd)->VfRead(buf, s1, s2, fd); //object-style call
(essentially already how the existing API does its API calls).
nevermind if a few other projects have apparently also used the name
"VFILE" for their VFS's...
or such...
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
stdin and stdout Bartc <bc@freeuk.com> - 2015-07-20 14:37 +0100
Re: stdin and stdout Richard Heathfield <rjh@cpax.org.uk> - 2015-07-20 14:58 +0100
Re: stdin and stdout Bartc <bc@freeuk.com> - 2015-07-20 15:31 +0100
Re: stdin and stdout Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-20 16:29 +0100
Re: stdin and stdout Bartc <bc@freeuk.com> - 2015-07-20 17:03 +0100
Re: stdin and stdout Ken Brody <kenbrody@spamcop.net> - 2015-07-20 12:09 -0400
Re: stdin and stdout Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-07-21 10:02 +0200
Re: stdin and stdout Keith Thompson <kst-u@mib.org> - 2015-07-20 11:19 -0700
Re: stdin and stdout Bartc <bc@freeuk.com> - 2015-07-20 19:38 +0100
Re: stdin and stdout Keith Thompson <kst-u@mib.org> - 2015-07-20 12:56 -0700
Re: stdin and stdout Bartc <bc@freeuk.com> - 2015-07-20 23:06 +0100
Re: stdin and stdout glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-20 23:18 +0000
Re: stdin and stdout BGB <cr88192@hotmail.com> - 2015-07-21 14:12 -0500
Re: stdin and stdout gordonb.9oj0u@burditt.org (Gordon Burditt) - 2015-07-21 19:14 -0500
Re: stdin and stdout Bartc <bc@freeuk.com> - 2015-07-22 11:11 +0100
Re: stdin and stdout gordonb.3xos3@burditt.org (Gordon Burditt) - 2015-07-22 20:05 -0500
Re: stdin and stdout Bartc <bc@freeuk.com> - 2015-07-23 09:27 +0100
Re: stdin and stdout Richard Damon <Richard@Damon-Family.org> - 2015-07-21 21:44 -0400
Re: stdin and stdout glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-22 04:10 +0000
Re: stdin and stdout BGB <cr88192@hotmail.com> - 2015-07-21 12:55 -0500
Re: stdin and stdout Bartc <bc@freeuk.com> - 2015-07-21 20:49 +0100
Re: stdin and stdout BGB <cr88192@hotmail.com> - 2015-07-22 00:05 -0500
Re: stdin and stdout "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-07-22 02:48 -0700
Re: stdin and stdout "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-07-22 02:57 -0700
Re: stdin and stdout gordonb.bjmxp@burditt.org (Gordon Burditt) - 2015-07-22 20:27 -0500
Re: stdin and stdout BGB <cr88192@hotmail.com> - 2015-07-22 13:19 -0500
Re: stdin and stdout Robert Wessel <robertwessel2@yahoo.com> - 2015-07-22 18:09 -0500
csiph-web