delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/09/02/12:30:07

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: scanf: strange behavior?
Date: Thu, 02 Sep 2004 12:27:52 -0400
Lines: 27
Message-ID: <2pp00iFnf7nsU1@uni-berlin.de>
References: <20040902144152 DOT GH6858 AT webhome DOT cz>
Mime-Version: 1.0
X-Trace: news.uni-berlin.de kPte6TLUHR1IUr2gur/NOAku2cgsG1YfpDb8ErQ7Q2BKf0i7Z9
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803
X-Accept-Language: en-us, en, de, fr, ru, zh, ja
In-Reply-To: <20040902144152.GH6858@webhome.cz>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Egon Eckert wrote:

> Hi,
> 
> compiling and running this code:
> 
> #include <stdio.h>
> 
> int main(int, const char**)
   ^^^^^^^^^^^^^^^^^^^^^^^^^^
After correcting this illegal and uncompilable line,

> {
>   char c[2];
>   printf("%d\n", sscanf("A", "%c%c", c, c + 1));
>   return 0;
> }
> 
> gives:
> 
> 1 in GNU libc (on Linux)
> 1 in Borland C++ 3.1 (on DOS)
> -1 in djgpp

djgpp yields 1.

Don't complain about what happens when you try compiling garbage.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019