Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to track down memory leak(s)
Message
From
26/09/2011 08:30:24
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01398453
Message ID:
01524711
Views:
96
>>>
>>>It's all a bit more involved. First, do you want to open the file with 12 (exclusive)? If so, I would not be able to analyze it, etc.?
>>>
>>>And it will require more changes - so becomes more complex to do a re-write.
>>
>>
>>
>>Not necessarily more complex
>>
>>You could have a function WriteLogLine() which in the current scenario would perform one strtofile()
>>That is already better
>>
>>As to the read access to the log file from another program, there must be a way using CreateFile() API http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
>>
>>Where
>>- dwDesiredAccess is GenericWrite
>>- dwShareMode is FILE_SHARE_READ
>>
>>
>>
>>And - for looking at the log file : tail - f comes to mind - I found a Windows version - not tested - http://tailforwin32.sourceforge.net/
>
>I'm still not getting it. Well, I found CreateFile example
>http://www.news2news.com/vfp/?example=10
>
>so, using that how do I add lines to the end of the file?


WriteFile() Api - I guess http://msdn.microsoft.com/en-us/library/aa365747(v=VS.85).aspx

You do not close the file, you just keep writing to it


>
>Also, what if I want to delete the log file in the process of my dll running - I assume I would not be able to?


You could, in a way, with PostMessage() from another process

The logger would just need to bindevent() on a message queue


(1) you use RegisterWindowMessage() http://msdn.microsoft.com/en-us/library/ms644947(VS.85).aspx to create a separate message queue
(2) You logger listens to that message queue with bindevent

(3) if you want the log cleared, you send a message (PostMessage()) to that separate queue. You do not have to know the hwnd of the logger - you can broadcast the message so that every one listening on the separate message queue receives the message - in this case ther will be only one process listening

http://msdn.microsoft.com/en-us/library/ms644944%28v=VS.85%29.aspx


(4) The logger receives the message - closes and recreates the file

You have to program for the event that the logger is writing to the log file at the time the message comes in



A nice challenge for the weekend ...
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform