简体   繁体   中英

Print in the console in Delphi Xe2 like in Java

I am working on a Delphi project for the first time, I used to develop on Java.

Is there a way to print in delphi's console like in java.

System.out.println("Message");

which I used to test code and find bugs (primitively).

You must use Writeln (only for console applications).

{$APPTYPE CONSOLE}
begin
  Writeln('Hello');
  Readln;
end.

如果要在IDE的事件日志中放置一个字符串,可以使用OutputDebugString函数。

I usually use the following code for "debugging" my programs.

    showmessage('Hello World');

That's how i do it.. :)

If you want something similar to Java console, you can use CodeSite , which uses an independent viewer

在此输入图像描述

Another similar tool is TraceTool

在此输入图像描述

More logging libraries on this question - Which logging library is better?

For debugging messages there is also the GExperts console to which you can write using the SendXXX procedures in GX_DbugIntf. This unit is part of the GExperts source code which is available on SourceForge .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM