1

I switched to VS Express 2012 for Windows Desktop from Turbo C (which is a terrible compiler) for writing C code. It is working fine, but the output is being displayed in a pop up commandline like window.I want the output in the "output window" which is at the bottom of VS ,which usually happens in VS.

I took the following steps.

  1. Created an empty project
  2. Changed the extension to c
  3. Under the compile as option, changed it to compile as c.

C programs are working fine. Also, its not recognizing getch() though getchar is available

Sanjana
  • 467
  • 2
  • 8
  • 20
  • The only thing that displays in the Visual Studio output window while your program is running is OutputDebugString. – Retired Ninja Sep 11 '13 at 07:01
  • getch() was deprectaed a long time ago – sara Sep 11 '13 at 07:50
  • The VS itself pauses the console screen after the output, there is no need of `getch()` or `getchar()` – 0xF1 Sep 11 '13 at 08:06
  • You have just started working on VS, so try researching on various menu options, try to find their purpose by Googling, I hope this way you will find solution to your this problem also. – 0xF1 Sep 11 '13 at 08:08
  • 1
    @Nishant ,it wont. You need to write getchar() or some other function to retain the console. – Sanjana Sep 11 '13 at 08:32
  • **Don't be hatin' on Turbo C.** It may not be up to snuff by modern standards, but it was absolutely revolutionary at the time. It created the modern IDE. Even the newest Visual Studio versions take a lot of their form from the Turbo C. – abelenky Sep 11 '13 at 14:46

1 Answers1

0
#include <windows.h>
#define ConsoleDebugPrintf(format, ...) \
    do { \
        char buf[512]; \
        snprintf(buf, sizeof buf, format, __VA_ARGS__); \
        OutputDebugString(buf); \
    } while (false);

You can use this macro just like printf. Maybe make buf bigger if you want.

Nicolas Louis Guillemot
  • 1,570
  • 1
  • 10
  • 23