Aaaah. Now I understand. You need to communicate with an console application (You mentioned the function printf.)?
Well if that's what you want to do you should make yourself familiar with
Pipes:
Pipes - MSDN. But I'm afraid you have to modify some parts of the code of the c-programs.