Embedding shell scripts in another language? [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is it possible to embed shell scripts into a higher-level programming language, for example, C++?
How would one go about doing that? For example, do you just place the script somewhere in the C++ code and the compiler is able to understand the script and the C++ code too?

Can you embed shell scripts into higher-level languages ?
Answer: Yes
You can always use the system api calls to execute any command and hence any shell script.
In C++, you can call the system function, like
#include<cstdlib>
system("myShellScrit.sh");

Related

Launching another application through c++ code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to know if there is a way to launch an application through a c++ code? As if I was launching it through the command line (with giving parameters for example).
If it exists, please can you provide me with both the windows code as well as linux code (in case they differ).
You can use system calls, like:
exec()
fork()
You can find plenty of examples. I had also answered a question about fork() here.
For exec(), you could read this: Please explain exec() function and its family.
For Windows, you can use one of the spawn family of functions, like _wspawnl. For Linux, you can use one of the exec family of functions, in combination with fork, like execl.

If I wanted to create a GUI for wget in c++.. where would I start? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Question is the title.
I'm sorry, I suppose I need to specify.
I'm not sure what commands or what code to use to actually link wget to a gui.
I have two weeks until classes start and I just want to Create something.
Maybe here and here. There are numerous widget toolkits for C++.
Since wget is not a HTTP library, but an application, calling this using system() or similar calls is disrecommended.
I advise you to use a HTTP C/C++ library.

C++ in powershell [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am in an environment which has no C++ compiler software installed, and I was wondering if it was possible for me to compile C++ code without having to install anything.
From within PS run help add-type -full and look for the F# example (example 7 on my system). Assuming you have a C++ compiler that follows the "CodeDom" model, you can mirror the F# example.
Of the two alternatives you gave, I'm going to go with "blindly obvious"

Lua, threads and C++ exceptions [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm planning on suggesting to my development team that we start looking at lua instead of C++ for the project we're currently working on. On that subject I have a question that I need to clear up first.
With the current SDK, we are not allowed to use C++ exceptions due to it not being safe in multithreaded applications (created with that SDK). Actually, it is allowed, just discouraged... however the program won't compile unless we pass -fno-exceptions, so... yeah...
Anyway. Since Lua runs in it's own VM and is pure C... Would exceptions in Lua be 'safe'?
If the C code that makes up the LUA interpreter is fine concerning the restrictions of your SDK then anything coded in LUA and executed with that interpreter is fine, too. But if the LUA interpreter itself is working with your unnamed SDK... that's a question that only you or the SDK vendor can answer.

C++ Command-Line program design UI? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am given a task to develop an C++ command-line(terminal, I am using, will run the program in Linux/Ubuntu) display. But I dont like the command-line design, is there anyway to improve the UI design?
Note: I must run the program in terminal!!
ncurses. It's a lib to be able to put text wherever you want in the terminal, so you can effectively draw, ascii-art style in the terminal. It's also a very old library, so it may be a little tedious to use.
I developed a simple multiplatform console management library some time ago.
You can use it at least on Linux and Windows. It uses native calls in Windows, and standard escape codes in other platforms.
If you just want to show some colors, position the cursor, and so on, you can use it in a matter of minutes without struggling with ncurses.
The documentation (generated with doxygen) is included in the Zip file.