www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/05/17:23:28

Message-ID: <37090A8C.89F098AA@cityweb.de>
From: David Renz <davidprrenz AT cityweb DOT de>
X-Mailer: Mozilla 4.03 [de] (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP-Problem
References: <37026DF6 DOT BCAA8E59 AT cityweb DOT de> <Pine DOT HPP DOT 3 DOT 95 DOT 990401074240 DOT 16475A-100000 AT hepo DOT cc DOT lut DOT fi>
Lines: 37
Date: Mon, 05 Apr 1999 21:10:04 +0200
NNTP-Posting-Host: 62.52.155.111
X-Trace: news2.cityweb.de 923341090 62.52.155.111 (Mon, 05 Apr 1999 21:38:10 MET DST)
NNTP-Posting-Date: Mon, 05 Apr 1999 21:38:10 MET DST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ville Kanerva wrote:

>> ...
>> scanf ("%d", &z);
>> 
>> printf ("Text:\n");
>> 
>> for (i=0;i<z;++i)
>> 
>> {
>> 
>> fflush(stdin);  /* i quess here's your problem */
>> 
>> gets(text[i]);
>> 
>> l[i]=strlen(text[i]);
>> 
>> }
>> ...
>> When I compile it with DJGPP and it should read n(z=n) Lines it only
>> reads n-1 lines. But when I compile it
>> with TurboC it runs correctly. Does someone know where there is a bug?
> 
> As i recall, you can't fflush _stdin_ stream, only _stdout_ stream. This
> may cause your problem and irregularities between those two compilers you
> used.
> 
No, that can't be the problem, when I leave out the fflush(stdin), it's
still wrong.
But when I replace the gets(text[i]) by scanf(text[i]) it runs
correctly. But with 
scanf you can only read words but no sentences(several words with
blanks). Can someone help?


Greetings,
David

- Raw text -


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