<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Appending to a Text file.' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Appending to a Text file.' posted on the 'Pascal' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 14:18:27 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 14:18:27 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392797/appending-to-a-text-file/</link>
      <description>&lt;br /&gt;
I have a version of Pascal without the append command.&lt;br /&gt;
&lt;br /&gt;
Is there a good way preferredly without reading through&lt;br /&gt;
the existing file to append text to a unix text file?&lt;br /&gt;
&lt;br /&gt;
I want to write a log file that may eventually get &lt;br /&gt;
very large.&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392797/appending-to-a-text-file/</guid>
      <pubDate>Wed, 24 Jun 2009 11:34:06 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392821/re-appending-to-a-text-file/#392821</link>
      <description>: I have a version of Pascal without the append command.&lt;br /&gt;
: Is there a good way preferredly without reading through&lt;br /&gt;
: the existing file to append text to a unix text file?&lt;br /&gt;
: I want to write a log file that may eventually get &lt;br /&gt;
: very large.&lt;br /&gt;
&lt;br /&gt;
You'd have to use the &lt;strong&gt;seek&lt;/strong&gt; ( seek(_file_,filesize(_file_)); ) command to jump to the end of the file, then do the write. The only problem that seek doesn't work w/ text files, You'd have to handle the textfile as a untyped one, and use &lt;strong&gt;blockwrite&lt;/strong&gt; instead of &lt;strong&gt;writeln&lt;/strong&gt; and setup the output data accordingly.&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392821/re-appending-to-a-text-file/#392821</guid>
      <pubDate>Wed, 24 Jun 2009 22:43:45 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392864/re-appending-to-a-text-file/#392864</link>
      <description>: : I have a version of Pascal without the append command.&lt;br /&gt;
: : Is there a good way preferredly without reading through&lt;br /&gt;
: : the existing file to append text to a unix text file?&lt;br /&gt;
: : I want to write a log file that may eventually get &lt;br /&gt;
: : very large.&lt;br /&gt;
: &lt;br /&gt;
: You'd have to use the &lt;strong&gt;seek&lt;/strong&gt; ( seek(_file_,filesize(_file_)); ) &lt;br /&gt;
: command to jump to the end of the file, then do the write. The only &lt;br /&gt;
: problem that seek doesn't work w/ text files, You'd have to handle &lt;br /&gt;
: the textfile as a untyped one, and use &lt;strong&gt;blockwrite&lt;/strong&gt; instead of &lt;br /&gt;
: &lt;strong&gt;writeln&lt;/strong&gt; and setup the output data accordingly.&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
Unfortunately the problem seems to be with the open.  I seemingly &lt;br /&gt;
only have rewrite (which erases the file before starting) and reset &lt;br /&gt;
(which puts me into a read only mode on the file).  All regardless,&lt;br /&gt;
to whether I am just writing text or record blocks. Seems to be&lt;br /&gt;
quite a shortcoming in the early Pascal.&lt;br /&gt;
&lt;br /&gt;
Or am I missing something.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392864/re-appending-to-a-text-file/#392864</guid>
      <pubDate>Thu, 25 Jun 2009 16:02:08 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392868/re-appending-to-a-text-file/#392868</link>
      <description>&lt;span style="color: Red;"&gt;: &lt;br /&gt;
: Unfortunately the problem seems to be with the open.  I seemingly &lt;br /&gt;
: only have rewrite (which erases the file before starting) and reset &lt;br /&gt;
: (which puts me into a read only mode on the file).  All regardless,&lt;br /&gt;
: to whether I am just writing text or record blocks. Seems to be&lt;br /&gt;
: quite a shortcoming in the early Pascal.&lt;br /&gt;
: &lt;br /&gt;
: Or am I missing something.&lt;br /&gt;
: &lt;/span&gt;&lt;br /&gt;
You're not missing anything.  These "shortcomings" of "early Pascal" was the driving force behind the 1983 standard and Turbo Pascal.  Is there something keep you from upgrading to a more modern implementation?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392868/re-appending-to-a-text-file/#392868</guid>
      <pubDate>Thu, 25 Jun 2009 20:20:07 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392901/re-appending-to-a-text-file/#392901</link>
      <description>&lt;br /&gt;
Shoot, I was afraid of that.   This is on an old legacy system that has been moved away from.  I am coding a special for a customer still running the old.   I will work my way around it.  &lt;br /&gt;
Thanks for the assistance.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392901/re-appending-to-a-text-file/#392901</guid>
      <pubDate>Fri, 26 Jun 2009 06:06:11 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392918/re-appending-to-a-text-file/#392918</link>
      <description>Early Pascal did not have &lt;strong&gt;seek&lt;/strong&gt; or &lt;strong&gt;blockwrite&lt;/strong&gt; so the solution suggested by Atex will not work either.  Probably the only solution is to copy the entire file to a scratch file, then write the new data to the scratch file.  If you are lucky your implementation will let you &lt;strong&gt;remove&lt;/strong&gt; your original file and &lt;strong&gt;rename&lt;/strong&gt; the scratch file, but most early Pascals did not have these capabilities.  Lacking these capabilities your only option will be the copy the scratch file back to your original, leaving the scratch file on the system.&lt;br /&gt;
&lt;br /&gt;
I think of "early Pascal", i.e., implementations based on the Jensen and Wirth descriptions, as an entirely different language than those based on the 1983 standard, e.g., Turbo Pascal, Free Pascal and Delphi.  Detractors of the language inevitably point out the Jensen/Wirth deficiencies, arguments have no validity when applied to modern implementations.&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392918/re-appending-to-a-text-file/#392918</guid>
      <pubDate>Fri, 26 Jun 2009 14:26:08 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392920/re-appending-to-a-text-file/#392920</link>
      <description>&lt;br /&gt;
I actually did have the &lt;strong&gt;seek&lt;/strong&gt; function and my &lt;strong&gt;write&lt;/strong&gt; functioned as a blockwrite as it did write out the record.  Unfortunately, it still could not be used to append as the problem still is in the opening of the file.&lt;br /&gt;
&lt;br /&gt;
Thanks.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392920/re-appending-to-a-text-file/#392920</guid>
      <pubDate>Fri, 26 Jun 2009 15:35:46 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392925/re-appending-to-a-text-file/#392925</link>
      <description>This is from TP7 help, but may have been implemented before:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
  Append (procedure)
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
 Opens an existing file for appending.

  Declaration:
  procedure Append(var f: Text);
 where:
  f is a text-file variable.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
LOL Just realized this is for Textfiles only. Could use it as a text file &amp;amp; just do Read() instead of readln().&lt;br /&gt;
&lt;br /&gt;
Also, just found this:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
  var
   F: file;
  begin
   {$I-}
   Assign(F, FileName);
   &lt;strong&gt;FileMode := 2;  ( Set file access to read/write }&lt;/strong&gt;
   Reset(F);
   Close(F);
   {$I+}
   FileExists := (IOResult = 0) and (FileName &amp;lt;&amp;gt; '');
  end;  { FileExists }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Change FileMode to Read/Write access. This should work.&lt;br /&gt;
&lt;br /&gt;
Otherwise something like this will work:&lt;br /&gt;
reset(file), rewrite(newfile), read data, write data, write new data, close(file), close(newfile), erase(file), rename (newfile, file).&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392925/re-appending-to-a-text-file/#392925</guid>
      <pubDate>Fri, 26 Jun 2009 18:50:10 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Appending to a Text file.</title>
      <link>http://www.programmersheaven.com/mb/pasprog/392797/392940/re-appending-to-a-text-file/#392940</link>
      <description>&lt;br /&gt;
Earlier I mentioned that the &lt;strong&gt;append&lt;/strong&gt; commad is not available to &lt;br /&gt;
me with my version.  That would be the ticket if it were.&lt;br /&gt;
&lt;br /&gt;
...and yes something along the lines of your last suggestion could be accommodated but the file being created has the possiblity of becoming quite large and reading through it each time to add 1 additional entry would not be acceptable.&lt;br /&gt;
&lt;br /&gt;
I will be doing one of a couple things, either living with a separate file for each log and utilizing a unix cron job to concatinate things or I have an ability to partner some "C" code with the Pascal to possibly do what I need.&lt;br /&gt;
&lt;br /&gt;
Bottom line, this can be considered closed...thanks to all who offered suggestions...albeit the one acknowledging Pascal's early shortcomings seems to be the most accurate hammer.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/392797/392940/re-appending-to-a-text-file/#392940</guid>
      <pubDate>Sat, 27 Jun 2009 09:48:48 -0700</pubDate>
      <category>Pascal</category>
    </item>
  </channel>
</rss>