1

I have a batch file I need to execute, it has one parameter, If I were to run this script myself I would open up cmd and write

lexparser.bat texfile.txt

and the output would then be printed to the console. I have shopped around and I have found some code which seems to be executing the file but I can't seem to extract the data being output, but I am unsure if this is correct.

QString pathDocument = qApp->applicationDirPath()+ "/stanford/lexparser.bat";
long result = (long)ShellExecute(0, 0, reinterpret_cast<const WCHAR*>(pathDocument.utf16()), 0, 0, SW_NORMAL);

I am using C++ as my language and I am also using the Qt Library to help me. I have limited programming ability so any help would be greatly appreciated

joshdt001
  • 28
  • 3

1 Answers1

0

I would recommend using QProcess for doing that.

See this question and its accepted answer for an example on how to do so.

Community
  • 1
  • 1
Tim Meyer
  • 12,210
  • 8
  • 64
  • 97