I/O error 32 when manipulating files

hi, when I did the coding to manipulate the file, i also met I/O error, the problem occurs when hitting the following command:
I am using windows 2000 and Delphi 6.0. Please tell me what happens and how to solve this problem!!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Please post your code that generate the error, then we can help.
I/O errors has alot of meansings
rewrite creates and opens a file ,
i/o 32 error is a "sharing violation"
(ie the file is already opened.)

so it sounds like you already opened the file, maybe using filecreate(),if that is the case then use fileclose() before calling rewrite()

example from help on rewrite usage:

var F: TextFile;

  AssignFile(F, 'NEWFILE.$$$');
  Writeln(F, 'Just created file with this text in it...');

if you still have problems post you code here
The win32 errorcode nr 32:

The process cannot access the file because it is being used by another process.

The error is a sharing violation, which can mean that your or another program has this files opened. For a <rewrite> you'll need of course exclusive rights, so the error has to occur, if there's something wrong.
Of course, if your program had opened the file before, you will have to close it, but maybe there's another program - in that case you only can prevent that ugly error-message by checking if your <rewrite> is possible.
Therefore you can disable the error-check temporarily :

 {$I-} // I/O-checking OFF
 {$I+} // I/O-checking ON - you should let it on elsewhere
 if Ioresult<>0 then begin
   // the file couldnt be created
 end else begin
   // all ok, file is rewritten

 Writeln(F, 'Just created file with this text in it...');

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cdbdelphiAuthor Commented:
Thanks a lot for you guys help! I try to solve that problem and I learn a lot more than the problem itself. It is a great place to get what I want to know...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.