C语言 如何在 Turbo C IDE 中查看我的程序的输出?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3252309/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I see the output of my program in the Turbo C IDE?
提问by subanki
How do I print #include<conio.h>in C
我如何#include<conio.h>在 C 中打印
#include<stdio.h>
#include<conio.h>
void main()
{
printf("#include<conio.h>");
}
How to get the output as
如何获得输出为
#include<conio.h>
you have to put getch(); and press Ctrl+f9 instead of alt+f5
你必须把 getch(); 然后按 Ctrl+f9 而不是 alt+f5
回答by MD Sayem Ahmed
I don't think you need to do anything else. You have written the solution yourself. All you have to do is just Compileand Run......... :)
我不认为你需要做任何其他事情。您自己编写了解决方案。所有您需要做的仅仅是Compile和Run......... :)
回答by Matt Curtis
If you are running it from an IDE, you might need to look at the output console or something, and maybe it closes when your program quits before you get a chance to see what it has printed.
如果您从 IDE 运行它,您可能需要查看输出控制台或其他东西,并且在您有机会看到它打印的内容之前,它可能会在您的程序退出时关闭。
If you are running it from the command line, maybe (because it doesn't print a newline after the string) your prompt is clobbering the output.
如果您从命令行运行它,可能(因为它不会在字符串后打印换行符)您的提示正在破坏输出。
回答by Sparkzz
I think you have a great confusion between the GCC(GNU Compiler Collection) and turbo c compilers.
我认为您在 GCC(GNU 编译器集合)和 turbo c 编译器之间存在很大的混淆。
In turbo C compilers the output will be stored separately in an output pane which can be viewed by pressing alt+F5.
在 turbo C 编译器中,输出将单独存储在输出窗格中,可以通过按alt+F5进行查看。
So in order to view the page while compiling you need to enter an input in the output page so that the page exits only after typing an input.
因此,为了在编译时查看页面,您需要在输出页面中输入一个输入,以便只有在输入输入后页面才会退出。
For doing this we are using a function called getch();which is obtained from the conio.hlibrary.
为此,我们使用了一个getch();从conio.h库中获得的调用函数。
Hence insert a getch();function after the printfstatement and press ctrl+F9.Now I hope the output is displayed.
因此在语句后插入一个 getch();函数printf并按ctrl+F9。现在我希望显示输出。
NOTE: - The output page might be displayed for other programs which contain a scanfstatement so that you can give an input on the output page.But even then you cannot able to see the output produced by printf statements after the scanf by pressing Ctrl+F9.
注意: - 可能会为包含scanf语句的其他程序显示输出页面,以便您可以在输出页面上提供输入。但即使如此,您也无法通过按 Ctrl+ 在 scanf 之后看到 printf 语句产生的输出F9.
回答by Jacob
If I remember Turbo C++ right (could be the same), you need to go to the Outputwindow to see the result. So go to Windowon the menu bar and select Output--- you should see your string there.
如果我记得 Turbo C++ 对(可能是一样的),你需要去Output窗口查看结果。因此,转到Window菜单栏上的 并选择Output--- 您应该在那里看到您的字符串。
If that doesn't work add getch();to the end of your program. This will ensure that the program will wait for a keystroke from the user before exit.
如果这不起作用getch();,请添加到程序的末尾。这将确保程序在退出之前等待用户的击键。
回答by dacris
What if you replace the 'printf' call with
如果您将 'printf' 调用替换为
fprintf(stderr, "#include<conio.h>");
Or, try this:
或者,试试这个:
_cprintf("#include<conio.h>");
Any luck?
运气好的话?
回答by Michael Mrozek
Sometimes the shell will overwrite the last printed line if it doesn't end in a newline; try adding a \nto the end of the printf
有时,如果最后一行没有换行,shell 会覆盖它;尝试将 a 添加\n到 printf 的末尾
回答by EMP
It works fine for me, but I suppose it's remotely possible that your STDOUT stream is not being flushed automatically. Try adding
它对我来说很好用,但我认为您的 STDOUT 流很可能没有被自动刷新。尝试添加
fflush(stdout);
after the printf.
之后printf。

