I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi Single User Apps Topic   Print This     

Fucking error 32..PLEASE HELP!!!!!!!

Fucking error 32..PLEASE HELP!!!!!!! in Delphi Single User Apps topic (part of our Pascal and Delphi Coding group).

Quick Search: Fucking   Fucking error   Fucking error 32  
nass
uk
i try to save a file on the disk using the following code, please:

procedure SaveFile;

begin
AssignFile(PathFilerout, temp '\Path.Ini');
Rewrite(PathFilerout);
Writeln(PathFilerout, TimeForm.OpenDialog1.Filename);
Writeln(PathFilerout,TimeForm.Edit1.Text);
Writeln(PathFilerout,TimeForm.Edit2.Text);
CloseFile(PathFilerout);
end;

now when the program reaches:
Rewrite(PathFilerout);

an exception occurs and the 'I/O Error 32'
occur.

I have searched ALL help menu and havent found any error w/ a number 32..

does anyone know whats wrong and how can i gget rid of this problem??
 Posted 18 years ago (Thread Starter)
Comment Quote
About nass -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread but email is NOT VERIFIED.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #4407, 1 replies
Thread Started 11/23/2001 1:28:00 PM
View Counter=1980
Last Reply Posted 12/6/2001 9:16:00 AM)
Location=uk  
Joined=18 years ago   MB Posts=3  
Most Recent Post
Larry J. Rutledge
Prestwood IT
Citrus Heights, CA USA
The first issue to address is the error code. There are a couple ways to identify what the code represents:

1) NET HELPMSG (or NET HELP) - If you are using Win 9x then use "NET HELP ", or with Win NT/2000 use "NET HELPMSG ". To use this command, open a DOS window and enter the appropriate line, replacing with the numeric code value.

C:\>NET HELPMSG 32

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


2) Use the pre-defined function SysErrorMessage(), which is defined in SysUtils.pas as:

function SysErrorMessage(ErrorCode: Integer): string;


This function converts OS error codes into strings. In this case, passing 32 as the ErrorCode would return the same message as was returned from NET HELPMSG above.


Now that we know how to identify the errors by their codes, we can see that the problem is that the file you are attempting to access is already open by some other process. The only way to resolve this is to use an alternate filename or wait until the file is no longer locked before writing to it.

To make the code cleaner, I would recommend trapping the EInOutError exception. Here's an example:


function SaveFile(fName: string; Data: TStringList): Boolean;
var
iCount: Integer;
FPathOut: TEXTFILE;

begin
Result := True;

AssignFile(FPathOut, IncludeTrailingBackslash(gsOutputPath) + fName);
try
RewriteFile(FPathOut);

for iCount := 0 to Data.Count - 1 do
WriteLn(FPathOut, Data[iCount]);

CloseFile(FPathOut);
except
on E: EInOutError do
begin
Result := False;
ShowMessage('Cannot save to this file, it is currently in use by another program.');
end;
end;
end;


Hope this helps,
Larry
Larry J. Rutledge

Analyst

Prestwood Software

www.prestwood.com
 Posted 18 years ago
Comment Quote
About Larry J. Rutledge -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Larry J. Rutledge
I worked for Prestwood Software as a Delphi developer from 1997 through 2002. During that time I enjoyed working with Mike Prestwood and the other developers at Prestwood.

Post ID #4526 (Level 1.1)  Reply to 4407
Thread Started 12/6/2001 9:16:00 AM
View Counter=2
Location=Citrus Heights, CA USA 
Joined=19 years ago   MB Posts=73   KB Posts=9  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1103A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #4407 Counter
1980
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech