🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #13146

Re: scanf

#13146
From: amphora
Date: Mon, 19 Mar 2001 20:07
38 lines
2129 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

El Sun, 18 Mar 2001 01:24:04 +0000, �ngel Su�rez Rivero escribi�:
- --
- --Totalmente de acuerdo pero como estoy utilizando "while" deber�a de
- --volver a escanear una nueva cifra hasta que scanf devuelva 1 cosa que no
- --hace.
- --Saludos.

En este caso scanf devuelve siempre 1. Prueba esto:
#include<stdio.h>

int main(void)
{
  auto int f,j;

  while(j=scanf(" %d",&f) ==1)
     printf(" %d \n",j);
     perror("MAL\n");
   /*..........*/

  return 0;
}
				 

- -- 
"Mr. Dedalus rasc�,encendi�,chup� una sabrosa  pipada...despu�s una
bocanada densa,apetitosa,chisporroteante" (James Joyce en "Ulysses")
amphora at escomposlinux dot org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6tNwUbxRsnxqoy84RAiK4AJ0dHy+DBr56CGRzbyjdGohL927VaACeMSwi
x6PXtMv326vpetaZXPmNYGs=
=waLI
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <p6m299.qa.ln@desdemona.dhis.org>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!xfer13.netnews.com!netnews.com!xfer02.netnews.com!newsfeed.skycache.com!Cidera!newsfeed.comtenidos.com!m2newsfeed.uni2.es!m2newsread.uni2.es.POSTED!not-for-mail
References: <3AB2A42F.8C677F1A@teleline.es> <87bsr0btai.fsf@relativistic.homeip.net> <3AB40E34.2E6C1244@teleline.es>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,fc6083ac2f27fd47
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-03-19 12:08:08 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!xfer13.netnews.com!netnews.com!xfer02.netnews.com!newsfeed.skycache.com!Cidera!newsfeed.comtenidos.com!m2newsfeed.uni2.es!m2newsread.uni2.es.POSTED!not-for-mail
From: amphora@desdemona.dhis.org (amphora)
Newsgroups: es.comp.os.linux.programacion
Subject: Re: scanf
References: <3AB2A42F.8C677F1A@teleline.es> <87bsr0btai.fsf@relativistic.homeip.net> <3AB40E34.2E6C1244@teleline.es>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: slrn/0.9.6.2 (Linux)
Message-ID: <p6m299.qa.ln@desdemona.dhis.org>
Lines: 38
Date: Mon, 19 Mar 2001 20:07:12 GMT
NNTP-Posting-Host: 62.36.130.176
X-Complaints-To: abuse@wanadoo.es
X-Trace: m2newsread.uni2.es 985032432 62.36.130.176 (Mon, 19 Mar 2001 21:07:12 MET)
NNTP-Posting-Date: Mon, 19 Mar 2001 21:07:12 MET
Organization: Servidor Usenet News de Uni2/Wanadoo