Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Capture Console display
Forum Updated to NodeBB v4.3 + New Features

Capture Console display

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k 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.
  • G Offline
    G Offline
    graham1941
    wrote on last edited by
    #1

    [Solved] I am currently working on a project to convert wav files to mp3's using lame.
    I note that lame's output on the console window displays its information in the same position on the screen. It also shows a 'running' progress display.
    Two questions:

    1. How does this display of data in the same position work?
    2. Can i 'capture' the progress and display it as a progress bar or a number graphically in my program?
      Any help would be much appreciated.
      Thank you
      Graham
    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      [quote author="graham1941" date="1398586809"]1. How does this display of data in the same position work?[/quote]

      It simply prints it to the console using printf() or probably fprintf(stderr, ...).

      Note: You can print "\r" (carriage return), instead of "\n" (line feed) in order to go back to the beginning of the line - and then you can simply overwrite the "old" line content. You can also go back an arbitrary number positions in the console by printing the proper number of "\b" (backspace) characters.

      For even more detailed control of the cursor positions use:
      "SetConsoleCursorPosition":http://goo.gl/V60QRv

      [quote author="graham1941" date="1398586809"]2. Can i 'capture' the progress and display it as a progress bar or a number graphically in my program?[/quote]

      Yes!

      See here how to do it:
      https://github.com/lordmulder/LameXP/tree/master/src

      (Especially "Encoder_MP3.cpp")

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • G Offline
        G Offline
        graham1941
        wrote on last edited by
        #3

        Thank you very much!
        Cheers
        G

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved