Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi,

die Forumsuche bietet ja sehr viel über das Thema.

system() ist schlecht, steht zumindest überall.

Aber mir fehlen jetzt die Alternativen.

Ich möchte z.B. eine Datei mit zip komprimieren. (Win und linux)

Oder speziell auf Linux jetzt ein .tar.gz macht

Was für einen Befehl verwende ich den jetzt?

Ich möchte möglichst plattformunabhängigkeit bleiben

und die Ausgabe der aufgerufenen Programme lesen.

Kann hier jemand etwas Licht ins Dunkel bringen??

Danke!

Gruß Scratch

  • Autor

Das hatte ich schon gelesen (Irgendwo in der Forumsuche gefunden).

Das Problem ist wohl das "platformunabhängig bleiben".

Dann mal anders wie kann ich den die Ausgabe von zB exec überwachen?

Gruß Scratch

  • Autor

Wie kann ich reagieren wenn ein Fehler Auftritt in dem externen Programm ...

Ich möchte zum Beispiel eine tar einer Datei machen und die Datei wird vorher gelöscht oder es wurden falsche Parameter übergeben, die Platte ist voll und solche Geschichten.

Mein Programm sollte dann reagieren können.

Im Prinzip die Rückgabe des Programms soll in meinem Programm sein ;-)

  • Autor

popen ... war die Lösung.

(Fast) plattformunabhängig und die Ausgabe des Programms kann in das eigene umgeleitet werden.

string execute(string strCommand)

{

	iSize = 255;


	FILE *myPipe;

	char cBuffer[iSize];


	string strData;


#ifdef _WIN32

	myPipe = _popen(strCommand.c_str(),"rt");

#else

	myPipe = popen(strCommand.c_str(),"r");

#endif


	if(myPipe != NULL)

	{

		strData = "";

		while(fgets(cBuffer,iSize,myPipe) != NULL)

		{

			strData = strData + cBuffer;

		}


#ifdef _WIN32

		_pclose(myPipe);

#else

		pclose(myPipe);

#endif

	}

	else

	{

		return "";

	}


	return strData;

}

Danke an alle, besonders an Klotzkopp!!

Gruß Scratch

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.