Browse Source

WIP: Add method to execute an external application

feature/exec_app
Martchus 5 years ago
parent
commit
c41d52b7c9
  1. 18
      application/commandlineutils.cpp
  2. 4
      application/commandlineutils.h

18
application/commandlineutils.cpp

@ -76,6 +76,24 @@ void startConsole()
ios::sync_with_stdio(true);
}
#ifdef PLATFORM_UNIX
/*!
* \brief Executes the specified \a app with the specified \a args.
* \param app Specifies the null-terminated application path.
* \param args Specifies the arguments as null-terminated array of null-terminated strings.
* \param outstring Specifies a string to save the standard output.
* \param errstring Specifies a string to save the standard error.
* \param outstream Specifies a stream to forward the standard output.
* \param errstream Specifies a stream to forward the standard error.
* \return Returns the return code.
* \throws Throws a std::runtime_error in case an error occurs.
*/
int execApp(const char *app, const char *const *args, string *outstring, string *errstring, ostream *outstream, ostream *errstream)
{
}
#endif
/*!
* \brief Convert command line arguments to UTF-8.
* \remarks Only available on Windows (on other platforms we can assume passed arguments are already UTF-8 encoded).

4
application/commandlineutils.h

@ -38,6 +38,10 @@ std::pair<std::vector<std::unique_ptr<char[]> >, std::vector<char *> > CPP_UTILI
# define CMD_UTILS_CONVERT_ARGS_TO_UTF8
#endif
#ifdef PLATFORM_UNIX
int execApp(const char *app, const char *const *args, std::string *outstring, std::string *errstring, std::ostream *outstream, std::ostream *errstream);
#endif
/*!
* \brief The Indentation class allows printing indentation conveniently, eg. cout << Indentation(4) << ...
*/

Loading…
Cancel
Save