Solved

Working With Typed Files

Posted on 2000-03-23
4
142 Views
Last Modified: 2010-04-04
I have created a typed file, but when I try to access the typed file to read from it I get an I/O error 103.  Can someone tell me what I'm doing wrong?
0
Comment
Question by:brettawv
  • 2
4 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2650573
hmm,
error 103 -> File not open (guess)
did you open the file with reset or what?

meikl
0
 
LVL 6

Accepted Solution

by:
DrDelphi earned 50 total points
ID: 2650583
Error 103 is a "File not open" ... probably a matter of either forgetting to close it after the last edit or you're not opening it correctly. Try this:

Var MyFile: File of MyType
   thefilename:string;
begin
Try
 TheFilename:='My file name here';
 assignfile(MyFile,thefilename);
if FileExists(thefilename) then
 Reset(Myfile)
Else
  Rewrite(Myfile);

 /// this checks to see if the file exists and opens it accordingly, either as a new file or a file to be edited.


Finally
  Closefile(myfile);
 end;

   
 
0
 

Author Comment

by:brettawv
ID: 2650742
Thanks.
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2651472
My pleasure. <g>
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

16 Experts available now in Live!

Get 1:1 Help Now