Solved

Delphi Programming question

Posted on 1997-07-28
2
132 Views
Last Modified: 2010-04-04
I have created a text file on F: the lan drive. Everynight I have to run a program which should rewrite this file. I do not have delete access on F: I can however erase the contents of the file, with which I am not having any luck. If I use reset procedure, the file is put in read-only mode. If I use append it is write only but I cannot loop until Bof to whitespace the previous records. I cannot use rewrite, erase or truncate as I get I/O errors on these procedures as I do not have rights to delete any file on F: How can I open my text file, loop through it to whitespace any records and then append the new data. This text file is being populated from some list boxes on my form.
Please help if you can.
Thank you
 Sam Kapoor
0
Comment
Question by:skapoor072897
2 Comments
 
LVL 1

Accepted Solution

by:
jackb022197 earned 0 total points
Comment Utility
AssignFile(f, 'F:\yourfile.txt');
FileMode := 1;      { Write only }
Reset(f);

Then loop through your file and append...


0
 

Author Comment

by:skapoor072897
Comment Utility
I have tried this bit of code, but I keep running into the same problem. First I define f as a file type variable. This is the code
egin
  AssignFile(f, 'f:\cmailtest\phone.txt');
  FileMode := 1; { Write only }
  Reset(f);
  while not eof(f) do
   begin
    writeln('     ');
   end;
On the writeln('      ') line I get an I/O error 103.
I have changed the variable f: to a textfile type and tried the sam e code with writeln(f,'      '). Same I/O error 103. I have tried writing to C instead of F but get the same I/O error. Maybe something is not write with the writeln statement. How do I write out whitespaces to this text file.
Please help if you can.
Thanks,
           SKapoor
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now