# OutputDebugString directly to file?

**URL:** <https://clarionhub.com/t/outputdebugstring-directly-to-file/5875>\
**Category:** questions\
**Tags:** debugging\
**Created:** [January 23, 2023, 6:29pm UTC](https://clarionhub.com/t/outputdebugstring-directly-to-file/5875 "2023-01-23T18:29:29Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [January 23, 2023, 6:35pm UTC](https://clarionhub.com/t/outputdebugstring-directly-to-file/5875/2 "2023-01-23T18:35:27Z")

</div>

Why not change your function that writes the ASCII Log file to first call OutputDebugString so you have both?

See also this post on [OutputDebugString](https://clarionhub.com/t/how-to-detect-if-an-outputdebugstring-viewer-is-running/241) that has links to how it works.

It is possible at runtime to hook the DLLs that call OutputDebugString by changing the DLL Import Table to point to your own replacement function. I used that method to hook the RTL call to WinHelp and instead call HtmlHelp. I thought I posted the code here or GitHub but cannot find it. This is complicated. It would be much easier to call your own Trace() function that calls OutputDebug plus writes a file.

---

_[View the full topic](https://clarionhub.com/t/outputdebugstring-directly-to-file/5875)._
