?
Solved

Delphi Programming question

Posted on 1997-07-28
2
Medium Priority
?
141 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
[X]
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
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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