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. displaying a variable's value every 30 seconds

displaying a variable's value every 30 seconds

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
5 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.
  • K Offline
    K Offline
    Keylee717
    wrote on last edited by
    #1

    I've been asked to display a variable's value every 30 seconds on stdout in the same display position on the same line of stdout without advancing the display position. I'm new to C++ and don't know how to begin with this. Please help! :sigh:

    D R A 3 Replies Last reply
    0
    • K Keylee717

      I've been asked to display a variable's value every 30 seconds on stdout in the same display position on the same line of stdout without advancing the display position. I'm new to C++ and don't know how to begin with this. Please help! :sigh:

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      To go to the start of the line again, simply output a '\r' char... I see dumb people

      1 Reply Last reply
      0
      • K Keylee717

        I've been asked to display a variable's value every 30 seconds on stdout in the same display position on the same line of stdout without advancing the display position. I'm new to C++ and don't know how to begin with this. Please help! :sigh:

        R Offline
        R Offline
        Renjith Ramachandran
        wrote on last edited by
        #3

        if you are in DOS mode you can use gotoxy(x, y) function like gotoxy(24, 12); cout<<"First 30 "; //30 sec delay logic here gotoxy(24, 12); cout<<"Second 30 "; that will output in the same screen coordinate The returned pointer may be temporary and should not be stored for later use.

        T 1 Reply Last reply
        0
        • R Renjith Ramachandran

          if you are in DOS mode you can use gotoxy(x, y) function like gotoxy(24, 12); cout<<"First 30 "; //30 sec delay logic here gotoxy(24, 12); cout<<"Second 30 "; that will output in the same screen coordinate The returned pointer may be temporary and should not be stored for later use.

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

          no, that function doesn't exist under VC++. that is a borland one... forget it, it is a non-standard (non-ANSI) function.

          TOXCCT >>> GEII power

          1 Reply Last reply
          0
          • K Keylee717

            I've been asked to display a variable's value every 30 seconds on stdout in the same display position on the same line of stdout without advancing the display position. I'm new to C++ and don't know how to begin with this. Please help! :sigh:

            A Offline
            A Offline
            avenger_sb25
            wrote on last edited by
            #5

            why r all ppl saying about '\r' when there is a smart option of '\b'. IT PUTS A BACKSPACE AND TAKES U WHERE U WERE. ...Avenger


            Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs

            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