<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — read  statement hangs]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=852</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=852&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in read  statement hangs.]]></description>
		<lastBuildDate>Fri, 15 Apr 2022 12:12:56 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: read  statement hangs]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3908#p3908</link>
			<description><![CDATA[<p>Imre,</p><p>I notice a couple things about your example.&nbsp; First, your format is looking for 80 single characters.&nbsp; When I use your format statement and enter text, I actually only get the first letter stored.&nbsp; You might instead want to use the more generic <em>&#039;(A)&#039;</em> text format for the read to make sure it reads all text up to the new line.</p><p>Regardless, I&#039;m not seeing a hang.&nbsp; My code:</p><div class="codebox"><pre><code>program cr
implicit none

    character(50)::line
    
    Print *, &quot;Enter some text:&quot;
    Read(*, &#039;(A)&#039;) line
    
    Print *, trim(line), len_trim(line)
    
end program cr</code></pre></div><p>seems to correctly register a string of zero length when I simply press <em>Enter</em>.&nbsp; Does the above work for you?</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Fri, 15 Apr 2022 12:12:56 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3908#p3908</guid>
		</item>
		<item>
			<title><![CDATA[Re: read  statement hangs]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3907#p3907</link>
			<description><![CDATA[<p>Though it&#039;s probably overkill and superstition, I&#039;d assign something to Line first, even if it&#039;s just Line = &quot;&quot; or Line = &quot; &quot;,<br />then I&#039;d put a Write, just under the Read, to write out Line and test it with data content. Finally, just hit the enter key as before. I do understand that it hangs after the Read with just Enter, you may not get to the Write in that case.</p><p>I&#039;m suggesting those steps because it more clearly brackets the issue. And it would be interesting to see if hitting the space bar and Enter works too. I mean a &lt;space&gt; in this context is just as fine as a letter or other data.</p><p>Also, I&#039;m suspicious of that 80a1 format. Can you make it more generic - What does Read(*,&#039;(a)&#039;) line do in its place (with data and with just an enter? or try 1a1 and test with one character.</p><p>Are you using a Mac or PC Platform?</p><p>I would have tired some of my suggestions first, but I can&#039;t just copy the code you provided and run it here. It doesn&#039;t like the<br />Read(*,1) line<br />1 format(80a1)<br />construction. So I&#039;d need your I/O statement in there too - something so I can duplicate the same success/error result.</p>]]></description>
			<author><![CDATA[null@example.com (designer)]]></author>
			<pubDate>Thu, 14 Apr 2022 18:04:05 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3907#p3907</guid>
		</item>
		<item>
			<title><![CDATA[read  statement hangs]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3906#p3906</link>
			<description><![CDATA[<p>My code reads character input from the console, this works fine, but if you hit enter without entering any data the read hangs and the only way out is to do a cntrl-c. I have tried iostat=, err=, eor=, size= (with advance=&#039;mo&#039;) ... but I have not found a way to detect a carriage return.</p><p>&nbsp; &nbsp; &nbsp;read (*,1) line<br />1&nbsp; &nbsp;format (80a1)</p><br /><p>Thanks, Imre</p>]]></description>
			<author><![CDATA[null@example.com (imre_varga)]]></author>
			<pubDate>Thu, 14 Apr 2022 16:11:28 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3906#p3906</guid>
		</item>
	</channel>
</rss>
