File read write with synchronization

General discussion about C/C++

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

File read write with synchronization

Postby Maddy » Mon Jun 20, 2011 6:57 am

Hello all,
I am writing an exe which does some functionality. I am writing logs to a file from that exe. From the same exe i am launching a DLL using LoadLibrary(). Now from the dll also i want to write logs to same log file which is created by the exe. Since i am getting file locked error when i try access that file from DLL. Can anyone tell me some solution for this?? I am using CreateFile api of windows. So what i need to do in order to write logs to same log files to which the exe is writing?? Please help me i am in trouble..
Thanks in advance.
Maddy
 
Posts: 1
Joined: Thu Jun 09, 2011 6:21 am

Re: File read write with synchronization

Postby ventsyv » Thu Jun 23, 2011 11:41 am

You have to pass in the stream reference in the dll method before you can write. Opening a new write stream will not work because the file is locked.
User avatar
ventsyv
 
Posts: 2810
Joined: Mon Sep 22, 2003 5:25 pm
Location: MD USA


Return to General

Who is online

Users browsing this forum: No registered users and 0 guests

cron