如何使用OutputDebugString打印字符串变量中的消息? [英] How do I use OutputDebugString to print a message that's in a string variable?
本文介绍了如何使用OutputDebugString打印字符串变量中的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近不得不在某些Delphi代码中进行一些更改。因此,我有一些基本问题:
I recently had to do some changes in some Delphi code. Therefore, I have some basics questions:
- 通常,如何输出到控制台?
- 如何使用
fx
作为字符串变量输出到控制台?
- Generally, how do I output to the console?
- How do I output to the console with
fx
that is a string variable?
我开始使用 OutputDebugString
,但是我无法使用它处理变量。
I started using OutputDebugString
, but I couldn't get it working with a variable.
推荐答案
您可以编写一个包装函数,以照顾传递给 OutputDebugString
的变量,因为它期望有一个PChar。
You can write a wrapper function to take care of the variables passed to OutputDebugString
as it expects a PChar.
类似的东西
procedure DebugMsg(const Msg: String);
begin
OutputDebugString(PChar(Msg))
end;
有一个有用的调试技术参考这里。
There is a useful reference for debugging techniques here.
如果您的Delphi有点生锈,那就永远有用的 Delphi基础网站。我经常使用它:)
And if your Delphi is a bit rusty there's the ever useful Delphi Basics site. I use it a lot :)
这篇关于如何使用OutputDebugString打印字符串变量中的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文