Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #82877

Re: Hello World in Russian

From James Kuyper <jameskuyper@alumni.caltech.edu>
Newsgroups comp.lang.c++
Subject Re: Hello World in Russian
Date 2022-01-30 14:02 -0500
Organization A noiseless patient Spider
Message-ID <st6nc3$teo$1@dont-email.me> (permalink)
References (1 earlier) <st362k$ham$1@dont-email.me> <st3n3o$cn4$1@dont-email.me> <st5hll$ppo$1@dont-email.me> <87tudle826.fsf@bsb.me.uk> <st628v$als$1@dont-email.me>

Show all headers | View raw


On 1/30/22 08:02, Alf P. Steinbach wrote:
> On 30 Jan 2022 13:12, Ben Bacarisse wrote:
>> "Alf P. Steinbach" <alf.p.steinbach@gmail.com> writes:
>>
>>> My opinion is that C (and hence also C++) text mode is an abomination
>>> that should never have been introduced, and that in addition, given
>>> that it was introduced, it's designed in a stupid way with the data
>>> conversion applied underneath the buffer level so that one can't get a
>>> clear view of the raw data.
>>>
>>> As an example, the design means that Unix `cat` can't be faithfully
>>> implemented in Windows using only standard C or C++, which IMO is
>>> extreme.
>>
>> I assume you are talking about the cases where cat defaults to reading
>> stdin and/or writing stdout, If so, it could be argued that it's not the
>> fault of the C and C++ standards, but more the fault of the
>> implementations not providing a useful freopen function.
>>
>> But then maybe freopen simply can't be implemented in Windows for some
>> mysterious reason I don't get.
>
> I guess you're talking about using standard C++ code with some system
> specific knowledge such as how to specify the standard input stream as
> a file name.
>
> To reopen the standard input so that it connects to the original
> source, which might a pipe or a file or the console, one needs to (1)
> identify that source, and (2) open that source, possibly after closing
> the original connection. Neither is feasible in general, even (AFAIK)
> in Unix environment. But one might attempt to sidestep (1) by using a
> filename that in the relevant OS denotes standard input.

No, freopen doesn't require a file name, or any of those other things.

"If filename is a null pointer, the freopen function attempts to change
the mode of the stream to that specified by mode , as if the name of the
file currently associated with the stream had been used. It is
implementation-defined which changes of mode are permitted (if any), and
under what circumstances." (C standard, 7.21.5.4p3).

If the implementation you're using fails to support changing text mode
to binary mode, that's hardly the fault of the C standard, that's up to
the implementation.

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Hello World in Russian Joseph Hesse <joeh@gmail.com> - 2022-01-29 05:51 +0200
  Re: Hello World in Russian James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-28 23:27 -0500
    Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-29 10:21 +0000
  Re: Hello World in Russian Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-01-28 22:42 -0800
    Re: Hello World in Russian David Brown <david.brown@hesbynett.no> - 2022-01-29 13:01 +0100
      Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-29 14:12 +0100
        Re: Hello World in Russian David Brown <david.brown@hesbynett.no> - 2022-01-29 17:34 +0100
      Re: Hello World in Russian James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-30 14:17 -0500
        Re: Hello World in Russian Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-01-30 20:17 -0800
  Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-29 11:48 +0100
    Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-29 17:39 +0200
      Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-30 09:18 +0100
        Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-30 12:12 +0000
          Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-30 14:02 +0100
            Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-30 14:45 +0000
              Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-30 21:53 +0100
                Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-30 21:00 +0000
            Re: Hello World in Russian James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-30 14:02 -0500
          Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-31 10:23 +0000
            Re: Hello World in Russian scott@slp53.sl.home (Scott Lurndal) - 2022-01-31 16:11 +0000
              Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-31 16:36 +0000
              Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-31 20:20 +0200
            Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-31 16:12 +0000
              Re: Hello World in Russian Muttley@dastardlyhq.com - 2022-01-31 16:39 +0000
                Re: Hello World in Russian Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-01-31 23:47 +0000
        Re: Hello World in Russian Manfred <noname@add.invalid> - 2022-01-31 16:45 +0100
        Re: Hello World in Russian Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-01-31 10:10 -0800
          Re: Hello World in Russian "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-01-31 19:25 +0100
      Re: Hello World in Russian Marcel Mueller <news.5.maazl@spamgourmet.org> - 2022-01-30 12:09 +0100
        Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-30 14:26 +0200
          Re: Hello World in Russian Richard Damon <Richard@Damon-Family.org> - 2022-01-30 08:59 -0500
            Re: Hello World in Russian Paavo Helde <eesnimi@osa.pri.ee> - 2022-01-30 18:21 +0200
              Re: Hello World in Russian Richard Damon <Richard@Damon-Family.org> - 2022-01-30 12:56 -0500
                Re: Hello World in Russian Vir Campestris <vir.campestris@invalid.invalid> - 2022-02-07 21:05 +0000

csiph-web