hi
wie kann ich einen vorhandenes Shellscript in einen C-Source einfügen ?
hab mal gehört, daß man sowas mit system (<command>); ausführen kann. Da ich mit C unter linux keinerlei Erfahrung habe, bitte ich um Hilfe. Das einzigste, was ich weiß ist, daß GNU installiert ist
DANKE
shellscript als C-Programm ?
Re: shellscript als C-Programm ?
Es geht genauso wie Du sagst.
Im C-Pogramm
system("name-des-auszuführenden-scripts");
einbauen.
Die notwendigen Include-Dateien sind in der man-page beschrieben, also man system.
Beispiel:
/*SYSTEM CALLS
Calls may be made to the Operating System to execute standard OPsys calls, eg, */
#include <process.h>
main() /* SYS.C */
{
char *command = "dir";
system( "cls" );
system( command );
}
/*Do not use this method to invoke other programs. Functions like exec() and spawn() are used for this. */
--------------------------
Gruss
Sulu
Im C-Pogramm
system("name-des-auszuführenden-scripts");
einbauen.
Die notwendigen Include-Dateien sind in der man-page beschrieben, also man system.
Beispiel:
/*SYSTEM CALLS
Calls may be made to the Operating System to execute standard OPsys calls, eg, */
#include <process.h>
main() /* SYS.C */
{
char *command = "dir";
system( "cls" );
system( command );
}
/*Do not use this method to invoke other programs. Functions like exec() and spawn() are used for this. */
--------------------------
Gruss
Sulu