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. cout

cout

Scheduled Pinned Locked Moved C / C++ / MFC
6 Posts 5 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.
  • S Offline
    S Offline
    Stirfie
    wrote on last edited by
    #1

    Is there a way to use cout<< or something like it without including iostream. I have a simple app with one cout statement and no inputs. The file is 5k without iostream included, but 260k with it. Regards Paul

    T 1 Reply Last reply
    0
    • S Stirfie

      Is there a way to use cout<< or something like it without including iostream. I have a simple app with one cout statement and no inputs. The file is 5k without iostream included, but 260k with it. Regards Paul

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      use printf();

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta

      S T 2 Replies Last reply
      0
      • T ThatsAlok

        use printf();

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        cheers, Alok Gupta

        S Offline
        S Offline
        Stirfie
        wrote on last edited by
        #3

        Thanks

        1 Reply Last reply
        0
        • T ThatsAlok

          use printf();

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          ...but you have to #include stdio... :D


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          D M 2 Replies Last reply
          0
          • T toxcct

            ...but you have to #include stdio... :D


            TOXCCT >>> GEII power
            [toxcct][VisualCalc]

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            But the two requirements were "...to use cout<< or something like it without including iostream." Using printf() and including stdio.h satisfy both of those requirements.


            "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

            1 Reply Last reply
            0
            • T toxcct

              ...but you have to #include stdio... :D


              TOXCCT >>> GEII power
              [toxcct][VisualCalc]

              M Offline
              M Offline
              mkuhac
              wrote on last edited by
              #6

              Try this, if you are using Win API only: INT CDECL ConPrintf (LPCTSTR lpszFormat, ...) { TCHAR szBuffer[1024]; INT iRet; DWORD cbWritten; HANDLE hStdOut = NULL; va_list va; va_start (va, lpszFormat); iRet = wvsprintf (szBuffer, lpszFormat, va); va_end (va); hStdOut = GetStdHandle (STD_OUTPUT_HANDLE); WriteConsole (hStdOut, szBuffer, iRet * sizeof (TCHAR), &cbWritten, NULL); return iRet; } Usage is identical to wsprintf, but it writes to console output.

              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