Results 1 to 3 of 3
  1. #1

    Mutex & exteranl file

    Iam trying to WebParseResponseHeader and extract a server ipaddress of a custom server then write the address to an external file. When I run with multiple users, I get the following error message:

    Cannot open data file, File:\temp\dummyfile.txt, Reason: SYSTEM: 32 - The process cannot access the file because it is being used by another process.r_2proliant28200:00:19ErrorFWriteRuntime:5 8 - Invalid file handle: The parameter provided as a file handle is not valid.

    I tried to create mutex object but with no luck. Any help is appreciated.Here is the code:
    transaction TmyTrans1
    hMutex := CreateMutex("MutexObject");
    WaitForSingleObject(hMutex, INFINITE);

    Fopen (hFile, "c:\\ipAddress [img]images/icons/frown.gif[/img] [img]images/icons/frown.gif[/img] .txt", OPT_FILE_ACCESS_READWRITE, OPT_FILE_OPEN);

    FWrite(hFile,"The ipAddress of the server is ",32,OPT_FILE_APPEND, nWritten);

    WebParseResponseHeader(sHeader1,sizeofsHeader1),"F rom");
    WebUrl("", 1.05);
    sOutput := sHeader1;
    FWrite(hFile, sOutput, 100, OPT_FILE_APPEND, nWritten);

    FClose(hFile);write("file closed"); writeln;

    end TmyTrans1;

  2. #2

    Re: Mutex & exteranl file

    Try CreateMutexEx, CreateSemaphore or GlobalResourceEnter.

  3. #3

    Re: Mutex & exteranl file

    Close the file BEFORE you release the mutex.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 05:25 PM.

Copyright BetaSoft Inc.