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.

Textdatei ausgeben

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich programmiere noch nicht lange C++ und habe da mal eine Frage. Ich möchte ein Programm schreiben welches mir eine Text-Datei ausgibt. So weit so gut. Allerdings möchte in den Text das Ergebnis von Berechnungen einbauen die ich zuvor gemacht habe.

So in etwa: cin << A, cin << B, C=A+B, und nun soll die Variable C in den Text eingebaut werden.

Geht das? Und wenn ja, wie?

 char Ausgabe[]=

    {

     "Mein Text"       

    };  



    char Datei[]={"d:\\Programmieren\\C++\\Test\\Ausgabe.txt"};

    FILE *MeineDatei;                                


    if((MeineDatei = fopen(Datei, "w+"))!=0)        

    { 

        fwrite(Ausgabe, sizeof(char), strlen(Ausgabe), MeineDatei);     

    } 

    else 

        cout << "Fehler - Datei konnte nicht geöffnet werden!\n"; 


    fclose(MeineDatei);  

Da wo "mein Text" steht soll praktisch später z.B. stehen: Das Ergebnis lautet: "C"...

Hoffe mir kann jmd helfen.

Danke.

Dr.Acula

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.