0

I am trying to use Boost.Asio's object_handle to wait for input from the console:

int main()
{
    using namespace boost::asio;

    io_service io;

    windows::object_handle in(io);
    in.assign(::GetStdHandle(STD_INPUT_HANDLE));

    in.wait();

    io.run();
    return 0;
}

This works if I run it from the terminal, but when I try to debug into it with Visual Studio it skips wait(). What's going on?

Kietz
  • 1,186
  • 11
  • 19

1 Answers1

1

A windows console application can create it's own console, or it can attach to an existing console (e.g. the parent command shell). This is likely what creates the difference.

You can influence the console allocation usually with things like start cmd /c myprog vs. ``start /b cmd /c myprog`, or you can explicitly create you console

The MSDN article that has the backgrounds and APIs is here:

sehe
  • 374,641
  • 47
  • 450
  • 633