Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Ostream pointer to the standard output

Ostream pointer to the standard output

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tom76
    wrote on last edited by
    #1

    Hello! I'm taking a couple of functions from a windows program and putting them in to my console application (with mfc) but to call one function I need a pointer to the output device. In windows this pointer pointed to a list box, but since consoles don't have those I want to write to the basic output device (like cout does). I've got ostream* Console = NULL; Console = ??? I can't find out how to tell the pointer that it points to the console window. Is this possible? The functions simply get the atached printers and display the text strings. Obseve everything, remember more...

    U 1 Reply Last reply
    0
    • T tom76

      Hello! I'm taking a couple of functions from a windows program and putting them in to my console application (with mfc) but to call one function I need a pointer to the output device. In windows this pointer pointed to a list box, but since consoles don't have those I want to write to the basic output device (like cout does). I've got ostream* Console = NULL; Console = ??? I can't find out how to tell the pointer that it points to the console window. Is this possible? The functions simply get the atached printers and display the text strings. Obseve everything, remember more...

      U Offline
      U Offline
      udayGovekar
      wrote on last edited by
      #2

      Check this, BOOL bFlag = AllocConsole(); HANDLE hnd =GetStdHandle(STD_OUTPUT_HANDLE); DWORD dw = GetLastError(); unsigned long i; WriteConsole(hnd,"test", 4,&i , NULL);

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups