简体   繁体   中英

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>
#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?

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