Hi There
i am developing a little Game Center (console application) for school. The Tic Tac Toe (singelplayer and Multiplayer) is already done. Now i want to develop a snake. When i test the snake, i get a force close. When i use a debugger, i have a SIGSEGV Error. This is the code (not all of the code):

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>


void ResizeConsole(short x, short y) //Bildschirmgrösse
{
	HANDLE hStdout;
	hStdout = GetStdHandle(STD_OUTPUT_HANDLE);

	CONSOLE_SCREEN_BUFFER_INFO Info;
	SMALL_RECT rcWindow;

	// Aktuelle Fenster- und Buffergröße
	GetConsoleScreenBufferInfo(hStdout, &Info);

	// Neue Fenstergröße
	rcWindow = Info.srWindow;
	rcWindow.Right  = x;
	rcWindow.Bottom  = y;

	// Neue Buffergröße, wenn nötig
	COORD size = Info.dwSize;
	if (size.X < x) size.X = x+1;
	if (size.Y < y) size.Y = y+1;

	SetConsoleScreenBufferSize(hStdout, size);
	SetConsoleWindowInfo( hStdout, TRUE,  &rcWindow);
}



void cls()
{
    system("cls");
}

int ki(char ft0, char ft1, char ft2, char ft3, char ft4, char ft5, char ft6, char ft7, char ft8) //Finish Tic Tac Toe
{
    //printf("\n%c %c %c\n", ft0, ft1, ft2);
    //printf("%c %c %c\n", ft3, ft4, ft5);
    //printf("%c %c %c\n", ft6, ft7, ft8);



    if(ft0=='X' && ft1=='X' && ft2=='X')
    {
        return -1;
    }
    else if(ft3=='X' && ft4=='X' && ft5=='X')
    {
        return -1;
    }
    else if(ft6=='X' && ft7=='X' && ft8=='X')
    {
        return -1;
    }
    else if(ft0=='X' && ft3=='X' && ft6=='X')
    {
        return -1;
    }
    else if(ft1=='X' && ft4=='X' && ft7=='X')
    {
        return -1;
    }
    else if(ft2=='X' && ft5=='X' && ft8=='X')
    {
        return -1;
    }
    else if(ft0=='X' && ft4=='X' && ft8=='X')
    {
        return -1;
    }
    else if(ft2=='X' && ft4=='X' && ft6=='X')
    {
        return -1;
    }

    //spieler 2 hat gewonnen:
    else if(ft0=='O' && ft1=='O' && ft2=='O')
    {
        return 1;
    }
    else if(ft3=='O' && ft4=='O' && ft5=='O')
    {
        return 1;
    }
    else if(ft6=='O' && ft7=='O' && ft8=='O')
    {
        return 1;
    }
    else if(ft0=='O' && ft3=='O' && ft6=='O')
    {
        return 1;
    }
    else if(ft1=='O' && ft4=='O' && ft7=='O')
    {
        return 1;
    }
    else if(ft2=='O' && ft5=='O' && ft8=='O')
    {
        return 1;
    }
    else if(ft0=='O' && ft4=='O' && ft8=='O')
    {
        return 1;
    }
    else if(ft2=='O' && ft4=='O' && ft6=='O')
    {
        return 1;
    }

    //Unentschieden
    else if(ft0!=' ' &&
            ft1!=' ' &&
            ft2!=' ' &&
            ft3!=' ' &&
            ft4!=' ' &&
            ft5!=' ' &&
            ft6!=' ' &&
            ft7!=' ' &&
            ft8!=' ')
    {
        return 0;
    }
    else
    {
        return 0;
    }
}

int main(int argc, char *argv[])
{
int ende;
int spielzug;
int feld;
char f[9];
char ft[9];
char ft0;
char ft1;
char ft2;
char ft3;
char ft4;
char ft5;
char ft6;
char ft7;
char ft8;
int beginn;
int drehen;
int zufallszug;
int chance[9][10];
int timer0;
int timer1;
int spieler;
int modus;
int Spielfeld;
short x;
short y;
char xy[20][30];
int laenge;
int glied[100][2];
int score;

while(1==1)

{
    printf(" ________________________________________________ \n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("| WIllkommen zu meinem Game Center               |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("| Da die Entwicklung nun im Betastatus ist,      |\n");
    printf("| gibt es nun ein singelplayer-Modus             |\n");
    printf("| und ein Multiplayer-Modus des Tic Tac Toe's    |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("| Bitte druecken sie Enter um zu spielen         |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|________________________________________________|\n");

    x=49;
    y=20;
    ResizeConsole(x, y);
    char enter=0;                                                             //Warten auf Enter
    while (enter != '\r' && enter != '\n') { enter = getchar(); }               //Warten auf Enter

    cls();                                                              //cls-befehl

    beginn=1;
    ende=0;
    drehen=0;
    f[0]=' ';
    f[1]=' ';
    f[2]=' ';
    f[3]=' ';
    f[4]=' ';
    f[5]=' ';
    f[6]=' ';
    f[7]=' ';
    f[8]=' ';
    ft[0]=' ';
    ft[1]=' ';
    ft[2]=' ';
    ft[3]=' ';
    ft[4]=' ';
    ft[5]=' ';
    ft[6]=' ';
    ft[7]=' ';
    ft[8]=' ';
    ft0=' ';
    ft1=' ';
    ft2=' ';
    ft3=' ';
    ft4=' ';
    ft5=' ';
    ft6=' ';
    ft7=' ';
    ft8=' ';
    spielzug=1;
    zufallszug=0;
    srand ( time(NULL) );
    timer0=0;
    timer1=0;
    spieler=1;
    modus=0;
    Spielfeld=0;
    laenge=3;
    timer0=0;
    score=0;
    while(timer0!=100)
    {
        glied[timer0][0]=0;
        glied[timer0][1]=0;
        timer0=timer0+1;
    }


    printf(" ________________________________________________ \n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("| Bitte wählen sie ein Modus aus:                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("| 1) Tic Tac Toe Singelplayer                    |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("| 2) Tic Tac Toe Multiplayer                     |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("| 3) Snake                                       |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|                                                |\n");
    printf("|________________________________________________|\n");

    printf(">");
    scanf("%d",&modus);fflush(stdin);

    if(modus==1) //multiplayer
    {
        ...
    }
            

    if(modus==2) //multiplayer:
    {
        ...
    }

    if(modus==3)//Snake
    {
        cls();
        printf(" ________________________________________________ \n");
        printf("|                                                |\n");
        printf("| Wählen sie ein Spielfeld aus:                  |\n");
        printf("|                                                |\n");
        printf("| 1) Normal      2) Stadt        3) Kreuz        |\n");
        printf("|                                                |\n");
        printf("|  ____________   _____________   _____________  |\n");
        printf("| |            | |    |        | |      |      | |\n");
        printf("| |            | |    |   |    | |      |      | |\n");
        printf("| |            | |    |   |____| |      |      | |\n");
        printf("| |            | |    |   |    | |______|______| |\n");
        printf("| |            | |  __|   |____| |      |      | |\n");
        printf("| |            | |        |    | |      |      | |\n");
        printf("| |            | |        |    | |      |      | |\n");
        printf("| |____________| |_____________| |______|______| |\n");
        printf("|                                                |\n");
        printf("|                                                |\n");
        printf("|________________________________________________|\n");

        printf(">");
        scanf("%d",&Spielfeld);fflush(stdin);
        x=50;
        y=23;
        ResizeConsole(x, y);
        if(Spielfeld==1)
        {

            glied[0][0]=15;                 //Bestimmung der Glieder
            glied[0][1]=10;
            glied[1][0]=15;
            glied[1][1]=11;
            glied[2][0]=15;
            glied[2][1]=12;                 //Fertig!
            xy[0][0]=' ';                   //Darstellung des Feldes;
            xy[29][0]=' ';
            timer1=1;
            while(timer1!=29)
            {
                xy[timer1][0]='_';
                xy[timer1][19]='_';
                timer1=timer1+1;
            }
            timer1=1;
            while(timer1!=20)
            {
                xy[0][timer0]='¦';
                xy[29][timer0]='¦';
                timer1=timer1++;
                printf("%d, ", timer1);
            }
            timer0=1;
            timer1=1;
            while(timer0!=29)
            {
                while(timer1!=19)
                {
                    xy[timer0][timer1]=' ';
                    timer1=timer1+1;
                }
                timer0=timer0+1;
                timer1=1;
            }                               //Fertit!


        }
        cls();
        printf(" _________________________________________________ \n");
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][0], xy[1][0], xy[2][0], xy[3][0], xy[4][0], xy[5][0], xy[6][0], xy[7][0], xy[8][0], xy[9][0], xy[10][0], xy[11][0], xy[12][0], xy[13][0], xy[14][0], xy[15][0], xy[16][0], xy[17][0], xy[18][0], xy[19][0], xy[20][0], xy[21][0], xy[22][0], xy[23][0], xy[24][0], xy[25][0], xy[26][0], xy[27][0], xy[28][0], xy[29][0]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][1], xy[1][1], xy[2][1], xy[3][1], xy[4][1], xy[5][1], xy[6][1], xy[7][1], xy[8][1], xy[9][1], xy[10][1], xy[11][1], xy[12][1], xy[13][1], xy[14][1], xy[15][1], xy[16][1], xy[17][1], xy[18][1], xy[19][1], xy[20][1], xy[21][1], xy[22][1], xy[23][1], xy[24][1], xy[25][1], xy[26][1], xy[27][1], xy[28][1], xy[29][1]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][2], xy[1][2], xy[2][2], xy[3][2], xy[4][2], xy[5][2], xy[6][2], xy[7][2], xy[8][2], xy[9][2], xy[10][2], xy[11][2], xy[12][2], xy[13][2], xy[14][2], xy[15][2], xy[16][2], xy[17][2], xy[18][2], xy[19][2], xy[20][2], xy[21][2], xy[22][2], xy[23][2], xy[24][2], xy[25][2], xy[26][2], xy[27][2], xy[28][2], xy[29][2]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][3], xy[1][3], xy[2][3], xy[3][3], xy[4][3], xy[5][3], xy[6][3], xy[7][3], xy[8][3], xy[9][3], xy[10][3], xy[11][3], xy[12][3], xy[13][3], xy[14][3], xy[15][3], xy[16][3], xy[17][3], xy[18][3], xy[19][3], xy[20][3], xy[21][3], xy[22][3], xy[23][3], xy[24][3], xy[25][3], xy[26][3], xy[27][3], xy[28][3], xy[29][3]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][4], xy[1][4], xy[2][4], xy[3][4], xy[4][4], xy[5][4], xy[6][4], xy[7][4], xy[8][4], xy[9][4], xy[10][4], xy[11][4], xy[12][4], xy[13][4], xy[14][4], xy[15][4], xy[16][4], xy[17][4], xy[18][4], xy[19][4], xy[20][4], xy[21][4], xy[22][4], xy[23][4], xy[24][4], xy[25][4], xy[26][4], xy[27][4], xy[28][4], xy[29][4]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][5], xy[1][5], xy[2][5], xy[3][5], xy[4][5], xy[5][5], xy[6][5], xy[7][5], xy[8][5], xy[9][5], xy[10][5], xy[11][5], xy[12][5], xy[13][5], xy[14][5], xy[15][5], xy[16][5], xy[17][5], xy[18][5], xy[19][5], xy[20][5], xy[21][5], xy[22][5], xy[23][5], xy[24][5], xy[25][5], xy[26][5], xy[27][5], xy[28][5], xy[29][5]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][6], xy[1][6], xy[2][6], xy[3][6], xy[4][6], xy[5][6], xy[6][6], xy[7][6], xy[8][6], xy[9][6], xy[10][6], xy[11][6], xy[12][6], xy[13][6], xy[14][6], xy[15][6], xy[16][6], xy[17][6], xy[18][6], xy[19][6], xy[20][6], xy[21][6], xy[22][6], xy[23][6], xy[24][6], xy[25][6], xy[26][6], xy[27][6], xy[28][6], xy[29][6]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][7], xy[1][7], xy[2][7], xy[3][7], xy[4][7], xy[5][7], xy[6][7], xy[7][7], xy[8][7], xy[9][7], xy[10][7], xy[11][7], xy[12][7], xy[13][7], xy[14][7], xy[15][7], xy[16][7], xy[17][7], xy[18][7], xy[19][7], xy[20][7], xy[21][7], xy[22][7], xy[23][7], xy[24][7], xy[25][7], xy[26][7], xy[27][7], xy[28][7], xy[29][7]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][8], xy[1][8], xy[2][8], xy[3][8], xy[4][8], xy[5][8], xy[6][8], xy[7][8], xy[8][8], xy[9][8], xy[10][8], xy[11][8], xy[12][8], xy[13][8], xy[14][8], xy[15][8], xy[16][8], xy[17][8], xy[18][8], xy[19][8], xy[20][8], xy[21][8], xy[22][8], xy[23][8], xy[24][8], xy[25][8], xy[26][8], xy[27][8], xy[28][8], xy[29][8]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][9], xy[1][9], xy[2][9], xy[3][9], xy[4][9], xy[5][9], xy[6][9], xy[7][9], xy[8][9], xy[9][9], xy[10][9], xy[11][9], xy[12][9], xy[13][9], xy[14][9], xy[15][9], xy[16][9], xy[17][9], xy[18][9], xy[19][9], xy[20][9], xy[21][9], xy[22][9], xy[23][9], xy[24][9], xy[25][9], xy[26][9], xy[27][9], xy[28][9], xy[29][9]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][10], xy[1][10], xy[2][10], xy[3][10], xy[4][10], xy[5][10], xy[6][10], xy[7][10], xy[8][10], xy[9][10], xy[10][10], xy[11][10], xy[12][10], xy[13][10], xy[14][10], xy[15][10], xy[16][10], xy[17][10], xy[18][10], xy[19][10], xy[20][10], xy[21][10], xy[22][10], xy[23][10], xy[24][10], xy[25][10], xy[26][10], xy[27][10], xy[28][10], xy[29][10]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][11], xy[1][11], xy[2][11], xy[3][11], xy[4][11], xy[5][11], xy[6][11], xy[7][11], xy[8][11], xy[9][11], xy[10][11], xy[11][11], xy[12][11], xy[13][11], xy[14][11], xy[15][11], xy[16][11], xy[17][11], xy[18][11], xy[19][11], xy[20][11], xy[21][11], xy[22][11], xy[23][11], xy[24][11], xy[25][11], xy[26][11], xy[27][11], xy[28][11], xy[29][11]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][12], xy[1][12], xy[2][12], xy[3][12], xy[4][12], xy[5][12], xy[6][12], xy[7][12], xy[8][12], xy[9][12], xy[10][12], xy[11][12], xy[12][12], xy[13][12], xy[14][12], xy[15][12], xy[16][12], xy[17][12], xy[18][12], xy[19][12], xy[20][12], xy[21][12], xy[22][12], xy[23][12], xy[24][12], xy[25][12], xy[26][12], xy[27][12], xy[28][12], xy[29][12]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][13], xy[1][13], xy[2][13], xy[3][13], xy[4][13], xy[5][13], xy[6][13], xy[7][13], xy[8][13], xy[9][13], xy[10][13], xy[11][13], xy[12][13], xy[13][13], xy[14][13], xy[15][13], xy[16][13], xy[17][13], xy[18][13], xy[19][13], xy[20][13], xy[21][13], xy[22][13], xy[23][13], xy[24][13], xy[25][13], xy[26][13], xy[27][13], xy[28][13], xy[29][13]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][14], xy[1][14], xy[2][14], xy[3][14], xy[4][14], xy[5][14], xy[6][14], xy[7][14], xy[8][14], xy[9][14], xy[10][14], xy[11][14], xy[12][14], xy[13][14], xy[14][14], xy[15][14], xy[16][14], xy[17][14], xy[18][14], xy[19][14], xy[20][14], xy[21][14], xy[22][14], xy[23][14], xy[24][14], xy[25][14], xy[26][14], xy[27][14], xy[28][14], xy[29][14]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][15], xy[1][15], xy[2][15], xy[3][15], xy[4][15], xy[5][15], xy[6][15], xy[7][15], xy[8][15], xy[9][15], xy[10][15], xy[11][15], xy[12][15], xy[13][15], xy[14][15], xy[15][15], xy[16][15], xy[17][15], xy[18][15], xy[19][15], xy[20][15], xy[21][15], xy[22][15], xy[23][15], xy[24][15], xy[25][15], xy[26][15], xy[27][15], xy[28][15], xy[29][15]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][16], xy[1][16], xy[2][16], xy[3][16], xy[4][16], xy[5][16], xy[6][16], xy[7][16], xy[8][16], xy[9][16], xy[10][16], xy[11][16], xy[12][16], xy[13][16], xy[14][16], xy[15][16], xy[16][16], xy[17][16], xy[18][16], xy[19][16], xy[20][16], xy[21][16], xy[22][16], xy[23][16], xy[24][16], xy[25][16], xy[26][16], xy[27][16], xy[28][16], xy[29][16]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][17], xy[1][17], xy[2][17], xy[3][17], xy[4][17], xy[5][17], xy[6][17], xy[7][17], xy[8][17], xy[9][17], xy[10][17], xy[11][17], xy[12][17], xy[13][17], xy[14][17], xy[15][17], xy[16][17], xy[17][17], xy[18][17], xy[19][17], xy[20][17], xy[21][17], xy[22][17], xy[23][17], xy[24][17], xy[25][17], xy[26][17], xy[27][17], xy[28][17], xy[29][17]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][18], xy[1][18], xy[2][18], xy[3][18], xy[4][18], xy[5][18], xy[6][18], xy[7][18], xy[8][18], xy[9][18], xy[10][18], xy[11][18], xy[12][18], xy[13][18], xy[14][18], xy[15][18], xy[16][18], xy[17][18], xy[18][18], xy[19][18], xy[20][18], xy[21][18], xy[22][18], xy[23][18], xy[24][18], xy[25][18], xy[26][18], xy[27][18], xy[28][18], xy[29][18]);
        printf("|         %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c          |\n", xy[0][19], xy[1][19], xy[2][19], xy[3][19], xy[4][19], xy[5][19], xy[6][19], xy[7][19], xy[8][19], xy[9][19], xy[10][19], xy[11][19], xy[12][19], xy[13][19], xy[14][19], xy[15][19], xy[16][19], xy[17][19], xy[18][19], xy[19][19], xy[20][19], xy[21][19], xy[22][19], xy[23][19], xy[24][19], xy[25][19], xy[26][19], xy[27][19], xy[28][19], xy[29][19]);
        printf("|_________________________________________________|\n");
        printf("Score: %c", score);
        system("PAUSE");
    }


    else //Wenn kein richtiger Modus gewählt wurde (nicht 1-3)
    {
        printf("Ihre Eingabe wahr nicht korrekt! Bitte geben sie einen verfuegbaren Modus ein!");
        system("PAUSE");
        cls();
    }
}
system("PAUSE");
return 0;
}

(I know i can not programm :-))
The Programm stops at line 325 - 331
Thank you for your help

Edited 4 Years Ago by tischn: n/a

The Programm stops at line 325 - 331

The array is being indexed with timer0, but the rest of the loop suggests that it should be using timer2. I'd guess that timer0 is out of bounds for the array, which is one of the big causes for a segmentation fault.

Yes that was a small mistake. But now the programm looks like this:

>1
2, 3, 4, 5, 6, 7,
Process returned -1073741819 (0xC0000005)   execution time : 13.189
Press any key to continue.

so it runs 7 times, but not 19...

0xC0000005 is an access violation, so the code probably still has a problem with out of bounds indexing. The code is large, and I'm disinclined to debug it given my current workload. Have you stepped through a short run in your debugger to help pinpoint where the violation is causing the program to terminate?

if you mean that, here is the call stack:

00000000	0x00404048 in ??() (??:??)
00000000	0x0040691f in ??() (??:??)
00000000	0x00000007 in ??() (??:??)
00000000	0x00470000 in ??() (??:??)
77B0B8BA	ntdll!RtlDowncaseUnicodeChar() (C:\Windows\system32\ntdll.dll:??)
00000000	0x01014618 in ??() (??:??)
00000000	0x0028fbd8 in ??() (??:??)
00000000	0x00470000 in ??() (??:??)
00000000	0x0028fcf0 in ??() (??:??)
77B51ECD	ntdll!AlpcMaxAllowedMessageLength() (C:\Windows\system32\ntdll.dll:??)
00000000	0x01f3bbff in ??() (??:??)
00000000	0xfffffffe in ??() (??:??)
77BB1694	ntdll!RtlDisableThreadProfiling() (C:\Windows\system32\ntdll.dll:??)
77B6AB3A	ntdll!AlpcMaxAllowedMessageLength() (C:\Windows\system32\ntdll.dll:??)
00000000	0x00470000 in ??() (??:??)
00000000	0x50000063 in ??() (??:??)
77B1387A	ntdll!RtlQueryEnvironmentVariable_U() (C:\Windows\system32\ntdll.dll:??)
00000000	0x766b967f in ??() (??:??)
00000000	0x00000000 in ??() (??:??)

I mean you need to get a debugger and step through each line of the code as it's executing. Monitor your indexes and make sure that they're always within bounds of the array's size.

But when i debugg the program with a Breakpoint, the debugger doesn't stop and goes to the line where the error is.

This article has been dead for over six months. Start a new discussion instead.