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 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
// C++ für Spieleprogrammierer // Listing 8.8 // Dateien: Ein- und Ausgabe // #include <iostream> #include <fstream> using namespace std; // Hauptprogramm // int main () { // Variablen // int Highscore = 0; // Aktuellen Highscore abfragen cout << "Wie hoch ist der Highscore: "; cin >> Highscore; // Datei zum Schreiben öffnen und Highscore hineinschreiben ofstream Output ("Highscore.hsc", ios::binary); Output.write ((char*) &Highscore, sizeof (Highscore)); // Datei schließen Output.close (); // Neues Spiel, neues Glück. Highscore zurücksetzen Highscore = 0; // Datei zum Lesen öffnen und highscore auslesen ifstream Input ("Highscore.hsc", ios::binary); Input.read ((char*) &Highscore, sizeof (Highscore)); // Datei schließen ;) Input.close (); // Highscore ausgeben cout << "Highscore aus der Datei: " << Highscore; cout << endl; cin.get (); return 0; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
1>------ Erstellen gestartet: Projekt: Listing 8.8, Konfiguration: Debug Win32 ------ 1>Kompilieren... 1>Listing 8_8.cpp 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(1) : error C2470: "h": Sieht wie eine Funktionsdefinition aus, es ist aber keine Parameterliste vorhanden; sichtbarer Funktionstext wird übersprungen. 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(1) : error C2059: Syntaxfehler: '>' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(8) : warning C4081: ')' erwartet; 'Zeichenfolge' gefunden 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(10) : error C2143: Syntaxfehler: Es fehlt ';' vor '{' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(10) : error C2447: '{': Funktionsheader fehlt - Parameterliste im alten Stil? 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(13) : warning C4002: Zu viele übergebene Parameter für das Makro '_crt_va_start' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(76) : warning C4068: Unbekanntes Pragma 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(76) : error C2018: Unbekanntes Zeichen '0x8' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(76) : error C2018: Unbekanntes Zeichen '0x60' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(104) : fatal error C1070: Fehlende Zuordnung von #if und #endif in Datei "c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl" 1>Das Buildprotokoll wurde unter "file://c:\Users\******\Documents\Visual Studio 2008\Projects\Listing 8.8\Listing 8.8\Debug\BuildLog.htm" gespeichert. 1>Listing 8.8 - 7 Fehler, 3 Warnung(en) ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ========== |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
h> #if defined(_M_CEE_MIXED) #pragma managed(push, off) #endif #pragma warning( push ) #pragma warning( disable : 4793 4412 ) static __inline int swprintf(wchar_t * _String, size_t _Count, const wchar_t * _Format, ...) { va_list _Arglist; int _Ret; _crt_va_start(_Arglist, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_at); _Ret = _vswprintf_c_l(_String, _Count, _Format _Format, NULL, _Arglist); _crt_va_end(_Arglist); return _Ret; } #pragma warning( pop ) #pragma warning( push ) #pragma warning( disable : 4412 ) static __inline int __CRTDECL vswprintf(wchar_t * _String, size_t _Count, const wchar_t * _Format, va_list _Ap) { return _vswprintf_c_l(_String, _Count, _Format, NULL, _Ap); } #pragma warning( pop ) #if defined(_M_CEE_MIXED) #pragma managed(pop) #endif #pragma warning( push ) #pragma warning( disable : 4793 4412 ) static __inline int _swprintf_l(wchar_t * _String, size_t _Count, const wchar_t * _Format, _locale_t _Plocinfo, ...) { va_list _Arglist; int _Ret; _crt_va_start(_Arglist, _Plocinfo); _Ret = _vswprintf_c_l(_String, _Count, _Format, _Plocinfo, _Arglist); _crt_va_end(_Arglist); return _Ret; } #pragma warning( pop ) #pragma warning( push ) #pragma warning( disable : 4412 ) static __inline int __CRTDECL _vswprintf_l(wchar_t * _String, size_t _Count, const wchar_t * _Format, _locale_t _Plocinfo, va_list _Ap) { return _vswprintf_c_l(_String, _Count, _Format, _Plocinfo, _Ap); } #pragma warning( pop ) #ifdef __cplusplus #pragma warning( push ) #pragma warning( disable : 4996 ) #pragma warning( push ) #pragma warning( disable : 4793 4141 ) extern "C++" _SWPRINTFS_DEPRECATED _CRT_INSECURE_DEPRECATE(swprintf_s) __inline int swprintf(_Pre_notnull_ _Post_z_ wchar_t * _String, _In_z_ _Printf_format_string_ const wchar_t * _Format, ...) { va_list _Arglist; _crt_va_start(_Arglist, _Format); int _Ret = _vswprintf(_String, _Format, _Arglist); _crt_va_end(_Arglist); return _Ret; } #pragma warning( pop ) #pragma warning( push ) #pragma warning( disable : 4141 ) extern "C++" _SWPRINTFS_DEPRECATED _CRT_INSECURE_DEPRECATE(vswprintf_s) __inline int __CRTDECL vswprintf(_Pre_notnull_ _Post_z_ wchar_t * _String, _In_z_ _Printf_format_string_ const wchar_t * _Format, va_list _Ap) { return _vswprintf(_String, _Format, _Ap); } #pragma warning( pop ) #pragma warning( pop ) #endif /* __cplusplus */ #endif /* RC_INVOKED */ #endif /* _INC_SWPRINTF_INL_ */ |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(12) : warning C4002: Zu viele übergebene Parameter für das Makro '_crt_va_start' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(12) : error C2065: '_CEE_t': nichtdeklarierter Bezeichner 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(12) : error C2065: '_CEE_t': nichtdeklarierter Bezeichner 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(12) : error C2070: ''unknown-type'': Ungültiger sizeof-Operand 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(13) : error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_Format' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(13) : error C2660: '_vswprintf_c_l': Funktion akzeptiert keine 3 Argumente 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(13) : error C2059: Syntaxfehler: ')' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(75) : warning C4068: Unbekanntes Pragma 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(75) : error C2018: Unbekanntes Zeichen '0x8' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(75) : error C2018: Unbekanntes Zeichen '0x60' 1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl(103) : fatal error C1070: Fehlende Zuordnung von #if und #endif in Datei "c:\program files (x86)\microsoft visual studio 9.0\vc\include\swprintf.inl" 1>Das Buildprotokoll wurde unter "file://c:\Users\******\Documents\Visual Studio 2008\Projects\lool\lool\Debug\BuildLog.htm" gespeichert. 1>lool - 9 Fehler, 2 Warnung(en) ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ========== |
C-/C++-Quelltext |
|
1 |
_crt_va_start(_Arglist, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_t, _CEE_at); |
C-/C++-Quelltext |
|
1 |
_crt_va_start(_Arglist, _Format); |
Alter Hase
Zitat von »"Jack_Rabbit"«
Ich mag microsoft nicht
Zitat
Zitat
Ich mag microsoft nicht Evil or Very Mad
Gibt ja zum Glück genügend Alternativen Wink
Werbeanzeige