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. [SOLVED] QProcess special symbols

[SOLVED] QProcess special symbols

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k Views
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello... I have process which execute following command - "cmd /C app.exe --arguments"... It works fine as long as arguments do not contain any special symbols (%&<)... My argument looks like --password "aa<we71%"...
    That argument does not work if I don't convert those special symbols like shown in "this ":http://www.robvanderwoude.com/escapechars.php website...

    "aa<we71%"

    I can change it manually into "aa^<we71%%" and it will work fine... But I want it to be automated... So I would like to know if Qt has any function that would convert string into command line readable text...

    @ QString name = "aa<we71%";

    name.replace("<", "^<");      // 1.st replace
    name.replace("%", "%%");  // 2.nd replace
    name.replace("^", "^^");       // 3rd replace
    

    @

    @I tried with code above but it does not work as supposed... It first replaces < with ^< and new word is "aa^<we71%"... But then in the next 3rd replace it will change ^ into ^^ and that is no longer symbol <...
    @
    I hope you understand what I am saying... So if Qt does not have any function that would do that, how can I do such thing? I could probably put each letter of the word into array and convert one by one and then put them together but that is my last option...

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, there's no such automatic conversion for special characters. So you would probably need e.g. a regexp to do it

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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