<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — Coding assistance]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=717</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=717&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Coding assistance.]]></description>
		<lastBuildDate>Sat, 03 Aug 2019 18:34:11 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Coding assistance]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3319#p3319</link>
			<description><![CDATA[<p>Hi all!</p><p>I received assistance from Dr Walt Brainerd of the Fortran Company.</p><p>See Fortran code for this request:</p><p>program Gary</p><p>&nbsp; &nbsp;implicit none<br />&nbsp; &nbsp;character(len=*), parameter :: text = &quot;Gary&quot;<br />&nbsp; &nbsp;character(len=100) :: line<br />&nbsp; &nbsp;integer :: gary_unit, ios<br />&nbsp; &nbsp;logical :: found_it</p><p>&nbsp; &nbsp;open (newunit=gary_unit, file=&quot;gary_file&quot;, &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;status=&quot;old&quot;, action=&quot;read&quot;, position=&quot;rewind&quot;)<br />&nbsp; &nbsp;found_it = .false.<br />&nbsp; &nbsp;do<br />&nbsp; &nbsp; &nbsp; read(unit=gary_unit, fmt=&quot;(a)&quot;, iostat=ios) line<br />&nbsp; &nbsp; &nbsp; if (is_iostat_end(ios)) exit<br />&nbsp; &nbsp; &nbsp; if (index(line, text) &gt; 0) then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;! Uncomment this &quot;if&quot; test to insert the line just once<br />!&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (.not. found_it) &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; write(unit=*, fmt=&quot;(a)&quot;) &quot;Line to be inserted&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;found_it = .true.<br />&nbsp; &nbsp; &nbsp; end if<br />&nbsp; &nbsp; &nbsp; write(unit=*, fmt=&quot;(a)&quot;) trim(line)<br />&nbsp; &nbsp;end do</p><p>end program Gary</p><p>Here is the input file &quot;gary_file&quot;. Create it with this name, no file extension.</p><p>line 1 aaaaaaaaa<br />line 2 bbbGarybbbb<br />line 3 ccccccc<br />line 4 Gary ddddd<br />line 5 eeee</p><p>Here is the output:</p><p>line 1 aaaaaaaaa<br />Line to be inserted<br />line 2 bbbGarybbbb<br />line 3 ccccccc<br />Line to be inserted<br />line 4 Gary ddddd<br />line 5 eeee</p>]]></description>
			<author><![CDATA[null@example.com (GS76)]]></author>
			<pubDate>Sat, 03 Aug 2019 18:34:11 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3319#p3319</guid>
		</item>
		<item>
			<title><![CDATA[Re: Coding assistance]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3318#p3318</link>
			<description><![CDATA[<p>Sounds like a typical programming course lab assignment.</p><p>There are many ways to do this task.&nbsp; You can&#039;t really &quot;insert&quot; lines into a text file, but you can copy the lines above the insert to a scratch file, write out the &quot;insert lines&quot;, and then copy the rest of the existing lines into the scratch file.&nbsp; Once that is done, you could delete the original file and rename the scratch file and you are done.</p><p>However, none of this will make any sense until you learn some basic Fortran.&nbsp; If you google Fortran tutorial you will find many online resources to get you started.</p>]]></description>
			<author><![CDATA[null@example.com (baf1)]]></author>
			<pubDate>Tue, 30 Jul 2019 21:14:42 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3318#p3318</guid>
		</item>
		<item>
			<title><![CDATA[Coding assistance]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=3317#p3317</link>
			<description><![CDATA[<p>Hi all,</p><p>Any assistance with regards my request.</p><p>I am new to programming and Fortran.</p><p>I wanted to know how to do the following:</p><p>1. Open a text file.<br />2. Insert &quot;text&quot; at a particular line number in the text file and/or before certain text in the file.<br />3. Save the file.<br />4. Close the file.</p><p>I would even pay for someone to assist me with this as it is a rush!</p><p>Where can I learn Fortran and/or do online training courses etc.</p><p>Thank you in advance.</p>]]></description>
			<author><![CDATA[null@example.com (GS76)]]></author>
			<pubDate>Tue, 30 Jul 2019 13:39:07 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=3317#p3317</guid>
		</item>
	</channel>
</rss>
