开发者

How can I see the output of my program in the Turbo C IDE?

How do I print #include<conio.h> in C

#include<stdio.h&开发者_运维问答gt;
#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


I don't think you need to do anything else. You have written the solution yourself. All you have to do is just Compile and Run......... :)


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.

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.


I think you have a great confusion between the GCC(GNU Compiler Collection) and turbo c compilers.

In turbo C compilers the output will be stored separately in an output pane which can be viewed by pressing 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.h library.

Hence insert a getch(); function after the printf statement and press ctrl+F9. Now I hope the output is displayed.

NOTE: - The output page might be displayed for other programs which contain a scanf statement 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.


If I remember Turbo C++ right (could be the same), you need to go to the Output window to see the result. So go to Window on the menu bar and select Output --- you should see your string there.

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.


It works fine for me, but I suppose it's remotely possible that your STDOUT stream is not being flushed automatically. Try adding

fflush(stdout);

after the printf.


Sometimes the shell will overwrite the last printed line if it doesn't end in a newline; try adding a \n to the end of the printf


What if you replace the 'printf' call with

fprintf(stderr, "#include<conio.h>");

Or, try this:

_cprintf("#include<conio.h>");

Any luck?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜