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
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
[Levels] LevelCount = 2 [Level1] RowCount = 4 Row1Blocks = " 1 1 1 " Row1Pos = -8, 0, 2 Row2Blocks = "12 111 21" Row2Pos = -8, 0, 1 Row3Blocks = "12 21" Row3Pos = -8, 0, 0 Row4Blocks = " 112 211 " Row4Pos = -8, 0, -1 |
C-/C++-Quelltext |
|
1 |
TB_INFO(ReadINIInt("Levels", "LevelCount")); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Liest einen int-Wert aus der INI-Datei int CGame::ReadINIInt(char* pcSection, char* pcKey) { char acString[256]; // String lesen ReadINIString(pcSection, pcKey, acString, 256); if(!strcmp(acString, "[NOT FOUND]")) return 12345678; // In int-Wert umwandeln return atoi(acString); } |
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 |
// Liest einen String aus der INI-Datei tbResult CGame::ReadINIString(char* pcSection, char* pcKey, char* pcOut, int iBufferSize) { TB_INFO(pcSection); TB_INFO(pcKey); TB_INFO(iBufferSize); // pruefen, ob datei existiert if(!tbFileExists("Data\\Breakanoid.ini")) { TB_ERROR("Data\\Breakanoid.ini wurde nicht gefunden!", TB_ERROR); } // String lesen GetPrivateProfileString(pcSection, pcKey, "[NOT FOUND]", pcOut, iBufferSize, "Data\\Breakanoid.ini"); TB_INFO(pcOut); return TB_OK; } |
Quellcode |
|
1 2 |
[Levels] LevelCount=2 |
C-/C++-Quelltext |
|
1 2 |
int CGame::ReadINIInt( const char* pcSection, const char* pcKey ); tbResult CGame::ReadINIString( const char* pcSection, const char* pcKey, char* pcOut, int iBufferSize ); |
Zitat von »"Visual C++ 2005 Express Edition"«
Unbehandelte Ausnahme bei 0x1013b36c in Breakanoid.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x00000100.
Zitat von »"disassembly"«
1013B36C movsx ecx,byte ptr [eax]
Treue Seele
C-/C++-Quelltext |
|
1 2 3 |
//Pseudo Code: char acBuffer[256]; ReadINIString("Sektor", "Key", acBuffer, 256); |
C-/C++-Quelltext |
|
1 2 3 |
//Pseudo Code: char* pcBuffer = new char[256]; ReadINIString("Section", "Key", pcBuffer, 256); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Liest einen int-Wert aus der INI-Datei int CGame::ReadINIInt(const char* pcSection, const char* pcKey) { char acString[256]; // String lesen ReadINIString(pcSection, pcKey, acString, 256); if(!strcmp(acString, "[NOT FOUND]")) return 12345678; // In int-Wert umwandeln return atoi(acString); } |
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 |
// Liest einen String aus der INI-Datei tbResult CGame::ReadINIString(const char* pcSection, const char* pcKey, char* pcOut, int iBufferSize) { TB_INFO(pcSection); TB_INFO(pcKey); TB_INFO(iBufferSize); // pruefen, ob datei existiert if(!tbFileExists("Data\\Breakanoid.ini")) { TB_ERROR("Data\\Breakanoid.ini wurde nicht gefunden!", TB_ERROR); } // String lesen GetPrivateProfileString(pcSection, pcKey, "[NOT FOUND]", pcOut, iBufferSize, "Data\\Breakanoid.ini"); TB_INFO(pcOut); return TB_OK; } |
C-/C++-Quelltext |
|
1 2 3 4 |
// String lesen GetPrivateProfileString(pcSection, pcKey, "[NOT FOUND]", pcOut, iBufferSize, "Data\\Breakanoid.ini"); |
C-/C++-Quelltext |
|
1 2 3 4 |
// String lesen GetPrivateProfileString(pcSection, pcKey, "[NOT FOUND]", pcOut, 256, "Data\\Breakanoid.ini"); |
C-/C++-Quelltext |
|
1 2 3 4 |
tbResult CGame::ReadINIString(const char* pcSection, const char* pcKey, char* pcOut, int iBufferSize) |
C-/C++-Quelltext |
|
1 |
ReadINIString(pcSection, pcKey, acString, 256);
|
Treue Seele
C-/C++-Quelltext |
|
1 |
return atoi(acString);
|
C-/C++-Quelltext |
|
1 |
return (int)acString; |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Liest einen int-Wert aus der INI-Datei int CGame::ReadINIInt(const char* pcSection, const char* pcKey) { char acString[256]; // String lesen ReadINIString(pcSection, pcKey, acString, 256); if(!strcmp(acString, "[NOT FOUND]")) return 12345678; // In int-Wert umwandeln int iTemp = atoi(acString); return iTemp; } |
Werbeanzeige