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. Qt console: Get text from text file as a console input parameter
Forum Updated to NodeBB v4.3 + New Features

Qt console: Get text from text file as a console input parameter

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 499 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
    sitesv
    wrote on 6 Nov 2020, 14:02 last edited by sitesv 11 Jun 2020, 14:03
    #1

    Hi!
    Is it possible to do something like this: "cat file.txt | ./myapp" for WINDOWS in Qt Creator debug mode?

    J 1 Reply Last reply 6 Nov 2020, 14:47
    0
    • S sitesv
      6 Nov 2020, 14:02

      Hi!
      Is it possible to do something like this: "cat file.txt | ./myapp" for WINDOWS in Qt Creator debug mode?

      J Offline
      J Offline
      JonB
      wrote on 6 Nov 2020, 14:47 last edited by JonB 11 Jun 2020, 14:53
      #2

      @sitesv
      I think you are asking: "Can I have stdin redirected when I start to debug my program?". And, to make it even harder, you want it to come from the output of a process, not just from a file?

      I believe you will struggle with this. I'm not even sure I can see how to do that for gdb. You say Windows, but give no indication while debugger you are using.

      Until someone answers better, I would say "no" to you. But I shall read with interest if someone says it can be done.

      You can sett command-line arguments. I don't know if it would allow redirection via < file.txt --- I would expect it does not (since the shell is what does that). Even if it does, that won't allow for input-from-a-command-pipe.

      From your example, it's just equivalent to setting stdin to read from file file.txt. If you do not get a satisfactory solutuon, would you consider changing your program's command-line arguments (even if only for debugging) to allow e.g. myapp -i file.txt? It would sure me a lot simpler/quicker? :)

      S 1 Reply Last reply 6 Nov 2020, 18:21
      2
      • J JonB
        6 Nov 2020, 14:47

        @sitesv
        I think you are asking: "Can I have stdin redirected when I start to debug my program?". And, to make it even harder, you want it to come from the output of a process, not just from a file?

        I believe you will struggle with this. I'm not even sure I can see how to do that for gdb. You say Windows, but give no indication while debugger you are using.

        Until someone answers better, I would say "no" to you. But I shall read with interest if someone says it can be done.

        You can sett command-line arguments. I don't know if it would allow redirection via < file.txt --- I would expect it does not (since the shell is what does that). Even if it does, that won't allow for input-from-a-command-pipe.

        From your example, it's just equivalent to setting stdin to read from file file.txt. If you do not get a satisfactory solutuon, would you consider changing your program's command-line arguments (even if only for debugging) to allow e.g. myapp -i file.txt? It would sure me a lot simpler/quicker? :)

        S Offline
        S Offline
        sitesv
        wrote on 6 Nov 2020, 18:21 last edited by
        #3

        @JonB, I believed that there is a simple analog for windows. Ok, thank you, I will work with file in the app.

        1 Reply Last reply
        0

        2/3

        6 Nov 2020, 14:47

        • Login

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