且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从作为服务运行的应用程序中编写文件

更新时间:2023-10-22 21:42:10

请参阅barneyman对问题的评论;这是非常合理的。



而不是直接写入文件,更好地利用 Windows事件日志的可靠性和灵活性。请从这里开始: https://msdn.microsoft。 com / zh-CN / library / windows / desktop / aa385780%28v = vs.85%29.aspx [ ^ ]。



-SA

I have no trouble logging to a file when running my app as a console app but if I convert it to run as a service my file writes fails it seems.

I'm writing in c/c++ using visual studio

Please see the comment to the question by barneyman; it is very reasonable.

Instead of writing directly to a file, better utilize reliability and flexibility of Windows Event Log. Please start here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385780%28v=vs.85%29.aspx[^].

—SA