Re: EOF question

From: Kenneth Brody (kenbrody+clc_at_spamcop.net)
Date: 08/11/04


Date: Wed, 11 Aug 2004 12:39:06 -0400

newby2c wrote:
>
> "CBFalconer" <cbfalconer@yahoo.com> wrote in message
> news:4118F86E.5F479632@yahoo.com...
> > No, line, enter, ctl-z, enter.
>
> Thanks again.
> Ran prog. Typed line. Hit <enter> (the caret moved to new line).
> Hit <ctrl-z>. Prog. terminates.
> Never had a chance to hit <enter>.
> This was the program in it's original form (without getchar();).
> With the getchar(); in place just before the return 0; I type some words,
> hit <enter>, then hit <ctrl-z>, (prog. does *not* terminate), lastly I hit
> <enter>. The prog. terminates, but there is still no output.
>
> newby2c
>
> newby2c

It could be a bug in Windows and/or the C runtime.

Change the printf() line to read:

     printf("aefore newline\nafter newline %ld\n",nc);

On Windows 98, with MSVC 6.0a (compiler version 12.00.8168) typing
"foobar" newline Ctrl-Z newline, I get:

    foobar
    after newline 7

Note that everything in the printf() prior to the newline is gone.

On Windows XP:

    foobar
    ^Z
    before newline
    after newline 7

And the program has not yet exited. I need to press Enter one more time
to get the program to exit.

-- 
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody        | www.hvcomputer.com |                             |
| kenbrody/at\spamcop.net | www.fptech.com     | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+


Relevant Pages

  • Re: EOF question
    ... > It could be a bug in Windows and/or the C runtime. ... > Note that everything in the printf() prior to the newline is gone. ...
    (comp.lang.c)
  • Re: Absolute Novice (Mac Tiger) Needs Help
    ... MacOS X is so newlines are linefeeds ... Windows didn't do the same because line the termination is two characters ... the meaning of \n and \r remain the ... to believe it until I can test it on a dodgy newline system such as ...
    (comp.lang.perl.misc)
  • Re: EOF question
    ... > It could be a bug in Windows and/or the C runtime. ... > Note that everything in the printf() prior to the newline is gone. ...
    (comp.lang.c)
  • Re: Forcing list context on <$fh>
    ... Please read this extract from "perldoc perlport": ... "Perl uses \n to represent the "logical" newline, ... It's been a _long time_ since I've used Windows. ... Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers ...
    (comp.lang.perl.misc)
  • Re: Environment.Newline
    ... non-Windows implementations of the C# language, compiler, and runtime environment. ... it compiles and runs anywhere Unix or Windows does. ... True, there are only two types of newline currently if you only count the latest PC operating systems, and hopefully that narrows to one in the future, but should it be the responsibility of the programmer to determine what operating system he is on and write logic that outputs the currect system newline? ... Ok, I can see in the docs that it represents "newline" for the current platform - I assume that it is a runtime property, and not compile time? ...
    (microsoft.public.dotnet.languages.csharp)