Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: rmoore@qualcomm.com (Ryan Moore)
Subject: Re: scanf problem on Vax C vs Dec C
Date: 1997/12/19	[thread overview]
Message-ID: <67eef5$7ei$1@thefuture.qualcomm.com> (raw)
In-Reply-To: 3499185B.63ED5638@tle.enet.dec.com


In article <3499185B.63ED5638@tle.enet.dec.com>, boris@tle.enet.dec.com says...
>
>Robert Young wrote:
>> 
>> I have code using Vax C on VMS that uses scanf. It appears to function
>> properly, waiting for a 'new line' character to be entered. Recompiled on
>> Dec C on an Alpha VMS system, scanf does not appear to wait for the new line
>> character. VMS is 6.1 in both cases with corresponding compatible (ie old)
>> compilers..
>> 
>> Any ideas? I am at a loss..........
>> 
>> Contact vyoung@groupz.net if you have an idea.......Thanks in advance
>
>  The problem does not necessarily have to do with the scanf
>  function itself. It may relate to the changes in C RTL I/O
>  subsystem as well. A small sample program demonstrating
>  different behaviour with VAX C and DEC C would help (the
>  smaller, the better).
>
>  The only difference in scanf between VAX C and DEC C I'm
>  aware of is processing scansets. DEC C behaviour is
>  ANSI-compliant while VAX C is not.


Here's an example of a difference:

#include <stdio.h>

main()
{
        char bar[50];

        printf("1: ");
        scanf("%s", bar);

        fflush(stdin);

        printf("2: ");
        scanf("%c", bar);
}

On VAX C, the second scanf() will wait until the user enters a character 
followed by the enter key.  On DEC C, the second scanf() will *not* wait for 
the user to enter a character.

VAX C v3.2-044 on VAX
DEC C V5.0-003 on Alpha

-Ryan





  reply	other threads:[~1997-12-19  5:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-17  5:00 scanf problem on Vax C vs Dec C Robert Young
1997-12-18  5:00 ` Boris Gubenko
1997-12-19  5:00   ` Ryan Moore [this message]
1997-12-19  5:00     ` Chris Engebretson
1997-12-19  5:00     ` Kaz Kylheku
1997-12-19  5:00 ` Ryan Moore
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox