Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Delphi Programming question

Posted on 1997-07-28
2
138 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
ID: 1340098
AssignFile(f, 'F:\yourfile.txt');
FileMode := 1;      { Write only }
Reset(f);

Then loop through your file and append...


0
 

Author Comment

by:skapoor072897
ID: 1340099
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

861 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