🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Porque fflush no funciona

#13981
From: Piriz
Date: Wed, 27 Dec 2000 17:05
24 lines
1375 bytes
Hola a todos tengo este peque~n codigo :

main (void) {
	char opc;
	do {
		printf("Introduce una opcion\n");
		opc=getchar();
		fflush(stdin);
		switch(opc) {
			case '1': printf ("Ha pulsado el uno\n");
				break;
			defaults : printf ("Ha pulsado otra tecla\n");
				break;
		}
	} while (opc!='3');
}
El problema es que fflush no me limpia el retorno de carro 
con lo cual pasa dos veces y no entiendo porque no 
funciona.Hay alguna otra solucion que no sea demasiado
aparatosa. Gracias.
-- 
Piriz.
Usuario de Linux registrado NīŋŊ 175336.
--
Technical Details
Message-ID: <slrn94k8a2.on.Piriz@redhat.red>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!newsfeed.online.be!fu-berlin.de!uni-berlin.de!45-vall-x8.libre.retevision.ES!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,666cb591e6a712c7,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2000-12-27 12:50:27 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!newsfeed.online.be!fu-berlin.de!uni-berlin.de!45-vall-x8.libre.retevision.ES!not-for-mail
From: Piriz@ctv.es (Piriz)
Newsgroups: es.comp.os.linux.programacion
Subject: Porque fflush no funciona
Date: Wed, 27 Dec 2000 18:05:06 +0100
Lines: 24
Message-ID: <slrn94k8a2.on.Piriz@redhat.red>
Reply-To: fpiriz@yahoo.com
NNTP-Posting-Host: 45-vall-x8.libre.retevision.es (62.83.212.45)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 977950225 6991682 62.83.212.45 (16 [39401])
User-Agent: slrn/0.9.6.2 (Linux)