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 479 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.
  • sitesvS Offline
    sitesvS Offline
    sitesv
    wrote on last edited by sitesv
    #1

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

    JonBJ 1 Reply Last reply
    0
    • sitesvS sitesv

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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #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? :)

      sitesvS 1 Reply Last reply
      2
      • JonBJ JonB

        @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? :)

        sitesvS Offline
        sitesvS Offline
        sitesv
        wrote on 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

        • Login

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