Article View: es.comp.os.linux.programacion
Article #15728Re: fflush(stdin) se me lo pasa por el forro?
From: Ignacio Arenaza
Date: Mon, 05 Jun 2000 00:00
Date: Mon, 05 Jun 2000 00:00
67 lines
2830 bytes
2830 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>>> "s.romero" == Santiago Romero <compiler@jet.es> writes:
s.romero> i�aki: he llegado en un programa a poner 3 scanfs
s.romero> seguidos:
s.romero> scanf("%d", &numero); scanf("%s", nombre); scanf("%s",
s.romero> apellido);
s.romero> eso, simplemente... y tras meter el numero se salta el
s.romero> del nombre y pasa directamente al apellido. En msdos
s.romero> poniendo un fflush(stdin) entre cada scanf() no se
s.romero> saltaba nada... LO MISMO PASA CON GETS y CON FGETS.
Pues ahi va lo que tengo yo:
Script started on Mon Jun 5 00:04:35 2000
bash-2.03$ cat kk.c
#include <stdio.h>
int main (void)
{
int kk;
char buf1[200], buf2[200];
printf ("Dame mas....\n");
scanf ("%d", &kk);
scanf ("%s", buf1);
scanf ("%s", buf2);
printf ("kk=%d, buf1=%s, buf2=%s.\n", kk, buf1, buf2);
exit(0);
}
bash-2.03$ gcc -Wall -O2 kk.c -o kk
bash-2.03$ ./kk
Dame mas....
123 bu1 bufffer2
kk=123, buf1=bu1, buf2=bufffer2.
bash-2.03$ ./kk
Dame mas....
1243
nimbre
y_apellidos
kk=1243, buf1=nimbre, buf2=y_apellidos.
bash-2.03$ exit
Script done on Mon Jun 5 00:05:24 2000
Asi que o me envias el ejemplo que usas tu y no te funciona o ya me
contaras...
Saludos. I�aki.
- --
Get PGP/GPG Keys at http://personales.jet.es/inaki.arenaza/pgpkey.html
A proud member of GULA - http://gula.hispalinux.es/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.4 and GPG
iD8DBQE5OtMYZXLnGT1HLgcRAuRWAJwM7iYhD+lNhKo4P3g5mvOrZLbgegCgj6LP
n0uXe4gRLD7ikQOIVa5WV1s=
=ZISZ
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<87d7lxqew5.fsf@eb2ebu.ampr.org>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<slrn8ifed1.190.nop_linux@compiler.linux.es> <87r9av1u79.fsf@eb2ebu.ampr.org> <slrn8iq65f.mk.compiler@compiler.linux.es> <87d7ma2t6m.fsf@eb2ebu.ampr.org> <slrn8jk6be.mc.compiler@compiler.linux.es>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f86c8,d38036c26efcd863 X-Google-Attributes: gidf86c8,public From: Ignacio Arenaza <iarenaza@eb2ebu.ampr.org> Subject: Re: fflush(stdin) se me lo pasa por el forro? Date: 2000/06/05 Message-ID: <87d7lxqew5.fsf@eb2ebu.ampr.org> X-Deja-AN: 631408402 Content-Transfer-Encoding: 8bit References: <slrn8ifed1.190.nop_linux@compiler.linux.es> <87r9av1u79.fsf@eb2ebu.ampr.org> <slrn8iq65f.mk.compiler@compiler.linux.es> <87d7ma2t6m.fsf@eb2ebu.ampr.org> <slrn8jk6be.mc.compiler@compiler.linux.es> Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@news.wanadoo.es X-Trace: m2newsread.uni2.es 960233419 62.36.64.115 (Mon, 05 Jun 2000 21:30:19 MET DST) Organization: Wanadoo Usenet News - Visita http://www.wanadoo.es/ MIME-Version: 1.0 User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5 NNTP-Posting-Date: Mon, 05 Jun 2000 21:30:19 MET DST Newsgroups: es.comp.os.linux.programacion