how to produce output without console window in c code? using dev c++ as compiler.say i have a prog. and it produces the output in console window as well as in text file. now i wan the output only in dat file not in console window. on executing the exe me.

Its possible may be..

I dont know in C but i saw a similar program in C++ .. though didnt understood ;-)

It is impossible. If it is possible it will become useless.

It's possible. It's not useless. The OP will need to elaborate more on his/her needs. Any output can go anywhere. It can go to the console. It can go to the serial or USB port. It can go to one or more files. It can go to any combination of these or it can go absolutely nowhere. It can also be piped/redirected to another process or another file. None of these are useless. It's just matter of of what your needs are.

To the OP:

Dev C++ has an option of whether you create a console window or not. It also has a variety of projects you can create, some of which create a window, some of which do not, and there is at least one check mark that you can uncheck so that you do not create a console window. I don't have Dev C++ installed, so this is from memory, put check out the Options or Preferences menus and see if there's something to check/uncheck. any 1 hlp me to hide the CPU window or output doesnt produce the console window. although the application is meant for creating the console application bt i wan my output of program to be written seperately and not in console window. it is writting the output in seperate file as well as in console window. bt i wan nt to create the output in console window.there is no such options in the compiler which doesnt produce the output in console application.i am using devc++ hlp me.

The thing is, there aren't too many programs that don't need a console window, at least.

Oh! I know one - a key logger!!

No, I won't be helping you. ;)

I used this C++ code for a virus which i did in C..

It was a self replicating Virus, for which i need to close hide the Window

Here is the code

void hide()
      typedef HWND (WINAPI *tGetConsoleWindow)(void);
  tGetConsoleWindow pGetConsoleWindow = 0;
  HINSTANCE handle =  ::LoadLibrary("Kernel32.dll");
  if ( handle ) 
    pGetConsoleWindow = (tGetConsoleWindow)::GetProcAddress(handle, "GetConsoleWindow");     
  if ( pGetConsoleWindow ) 
    HWND hwnd = pGetConsoleWindow();
  if ( handle )

>>there is no such options in the compiler which doesnt produce the output in console application.i am using devc++

Actually, there is. But I'm wondering if Adak is right. We don't give keylogger help here. What's the program supposed to do?

This article has been dead for over six months. Start a new discussion instead.