views:

61

answers:

3

FOLLOW-UP question : i'm calling the function repeatedly in a loop. when there are multiple items needed to to processed using that function, the application crashes. it works fine when only one item is processed. what to do?

[solved] i have a function in a dll that involves reading and writing a file. i'm calling the dll function in a test application but the file could not be written when the application is still open. i always need to close the test application first before the file could be successfully written.

what do i have to do to fix this?

Note: my dll is actually an .exe that i converted to dll

A: 

Open the file with the right sharing permissions? What API are you using to open the file?

MSN
A: 

I would recommend using a different file name when you call the function from your test code. If possible, modify the dll to accept a filename.

If not, make sure you open the file in shared mode.

Steve Rowe
+1  A: 

My guess would be the file is already open. Is your code doing a file open and then leaving the file open?

Check the code to make sure there is a matching file close for every file open.

jussij
that solved my problem. thanks!