X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Newsgroups: comp.os.msdos.djgpp Subject: Re: Why does read(*,*) not work in gfortran 4.x? From: Felix References: <83ty8m5gsz DOT fsf AT gnu DOT org> Organization: Home Message-ID: User-Agent: Xnews/5.04.25 Date: 10 Sep 2011 01:40:23 GMT Lines: 55 NNTP-Posting-Host: 4b5870c5.news.astraweb.com X-Trace: DXC=`hVg4Y^^jRmdoV AT f]470JnL?0kYOcDh AT jAJOl[ae^fNk;1gfI]1:T7kl9B_G1R=S=gKSnKQ<U\O7f9DMX:\\EXXh Bytes: 3009 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote in news:83ty8m5gsz DOT fsf AT gnu DOT org: >> From: Felix >> Date: 09 Sep 2011 03:54:25 GMT >> Bytes: 1253 >> >> program Test >> real first >> write (*,'(a)') 'Program to regurgitate a number' >> write (*,'(a,$)') 'Enter number: ' >> read (*,*) first >> write (*,'(a,f10.5)') 'Regurgitated number is', first >> stop >> end >> >> With GCC 4.6.1 and binutils 2.21.1 (or GCC 4.4.2 and binutils 2.19), >> this program does not properly execute the 'read (*,*)' statement. > > Details, please: what did you expect from this program and what > actually happened? > > I'm guessing that you bumped into some buffering issue, but it's > impossible to help you without more details. > > Also, what version of DJGPP library (djdevNNN.zip) do you have > installed? > All three DJGPP installations are on Windows XP SP3 systems. On all three installations, I have installed djdev203.zip. According to the files djdev203.ver and djdev203.dsm from the manifest directory, this corresponds to version 2.03 patchlevel 2, or the June 2002 refresh of djgpp203. Is there a different library for use with GCC 4.x? I would expect the program to print the prompt to the console window and then accept input from that console, echoing it as it is typed in. The prompt is displayed to the console but when I try to enter a number, I get no response: no echo of the keys I press. The only way to exit the program is by hitting the ^C key repeatedly. By the way, on at least one of the platforms with GCC 4.x installed, the program behaves the same way even if I include a format specifier such as '(f10.5)' in the read statement. I don't normally use DJGPP all that much, really. Lately, I mostly use it to test things I am likely to use or try out on the Linux machine at work. In this instance, I was going to test out how Python's subprocess module can be made to spawn off a Fortran program that requires input from the console. So I wrote this simple Fortran program to test it out only to find that this simple Fortran program does not even work when directly called from the console. Thanks for any help you can provide. Felix