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
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
......... :)
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
.
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.
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
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.
What if you replace the 'printf' call with
fprintf(stderr, "#include<conio.h>");
Or, try this:
_cprintf("#include<conio.h>");
Any luck?