Hier ist mein Code:
Code:
#include <iostream>
#include <windows.h>
#include <conio.h>
int KeyInput (int SleepTime)
{
_getch ();
if (GetAsyncKeyState (VK_UP)) return 1;
if (GetAsyncKeyState (VK_DOWN)) return 2;
if (GetAsyncKeyState (VK_LEFT)) return 3;
if (GetAsyncKeyState (VK_RIGHT)) return 4;
if (GetAsyncKeyState (VK_RETURN)) return 5;
if (GetAsyncKeyState (VK_SPACE)) return 6;
if (GetAsyncKeyState (VK_ESCAPE)) return 7;
Sleep (SleepTime);
return 0;
}
int main()
{
const int GAME_ARRAY_WIDTH = 9; //Jeweils +1, da es sich um
const int GAME_ARRAY_HEIGTH = 6;//Angaben für ein Array handelt
int gameArray[GAME_ARRAY_WIDTH][GAME_ARRAY_HEIGTH];
for (int y = 0; y <= GAME_ARRAY_HEIGTH; ++y)
for (int x = 0; x <= GAME_ARRAY_WIDTH; ++x)
gameArray[x][y] = 0;
for (int y = 0; y<= GAME_ARRAY_HEIGTH; ++y)
{
for (int x = 0; x <= GAME_ARRAY_WIDTH; ++x)
std::cout << gameArray[x][y];
std::cout << "\n";
}
return 0;
}
Hier ist mein Problem:
Code:
"1.exe": "D:\Users\Mosch\Documents\Visual Studio 2005\Projects\1\debug\1.exe" geladen, Die Binärdaten wurden nicht mit Debuginformationen erstellt.
"1.exe": "D:\Windows\System32\ntdll.dll" geladen, Keine Symbole geladen.
"1.exe": "D:\Windows\System32\kernel32.dll" geladen, Keine Symbole geladen.
"1.exe": "D:\Windows\System32\apphelp.dll" geladen, Keine Symbole geladen.
Eine Ausnahme (erste Chance) bei 0x00000000 in 1.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x00000000.
STATUS_STACK_BUFFER_OVERRUN encountered
Windows hat einen Haltepunkt in 1.exe ausgelöst.
Dies kann auf eine Beschädigung des Heaps zurückzuführen sein und weist auf ein Problem in 1.exe oder in einer der geladenen DLLs hin.
Weitere Analyseinformationen finden Sie möglicherweise im Ausgabefenster.
Das Programm "[464] 1.exe: Systemeigen" wurde mit Code 0 (0x0) beendet.
Irgendwelche Vorschläge? Das ist ja nun wirklich ein extrem simpler Code und ich weiss nicht, was da solche Probleme verursacht.