Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 |
std::string sString ifstream Input ("xx.txt", ios::app); Input.read (&sString, sizeof(sString)); Input.close(); cout<<sString<<endl; getch(); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 |
std::string sString ifstream Input ("xx.txt", ios::app); Input.read ((cahr*)sString, sizeof(sString)); Input.close(); cout<<sString<<endl; getch(); |
C-/C++-Quelltext |
|
1 2 3 |
std::string sString ifstream Input ("xx.txt"); Input >> sString; |
C-/C++-Quelltext |
|
1 2 3 |
std::string sString ifstream Input ("xx.txt"); std::getline(Input, sString); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 |
#include <fstream> #include <string> // ... std::string zweite = "eine zweite zeile"; std::ofstream datei("meineDatei.txt"); datei << "dies ist die erste zeile" << std::endl; datei << zweite << std::endl; |
C-/C++-Quelltext |
|
1 2 3 |
std::string beispiel = "ABCDEFGH"; std::cout << "Das erste Zeichen im String ist" << beispiel.at(0) << std::endl; std::cout << "Das zweite Zeichen im String ist" << beispiel[0] << std::endl; |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
string szOut = "Hallo,ich bins"; string szIn = ""; ofstream output("test.hsc", ios::app); output << szOut << endl; output.flush(); output.close(); ifstream input("test.hsc"); while(!input.eof()) { getline(input, szIn); if(!input.eof()) cout << "Wert aus Datei: " << szIn << endl; } input.close(); getch(); |
Werbeanzeige