Dev-C++ Error With printf Function

January 23, 2010 at 06:17:25
Specs: Windows XP
Okay, if I ever use the printf or cont function, the window will quickly close itself out. I know how to fix this when I am using the cont function (by putting cin.ignore() right after it), but how do I fix this when using the printf function. Can anyone help me?

I accidently put D-C++ in the topic title, it should read Dev-C++

See More: Dev-C++ Error With printf Function

Report •

January 23, 2010 at 11:25:17
It's not really printf, but "console" apps. If you try launching it from the cmd shell, then you *shouldn't* have that issue.

You can try one of these at the end of your code.

while(cin.get() != '\n'){}
while(getchar() != '\n'){}


Report •

January 23, 2010 at 11:46:01
If the problem is what I think it is, the easiest solution would be to use

just before ending the program.

Report •

January 24, 2010 at 05:28:32
Thank you both, but the one that I actually got to work was the while(getchar() != '\n'){} function being placed after the printf function, thank you!

Report •

Related Solutions

Ask Question