Witam. Piszę funkcję programu która ma za zadanie wczytać plik. Potrzebne mi do tego dynamicznej deklaracji tablic (wycinek kodu poniżej). Problem jest w tym iż za cholere nie wiem dlaczego przy deklarowaniu drugiej tablicy wyskakuje błąd :
Windows has triggered a breakpoint in skaterometr.exe.
This may be due to a corruption of the heap, which indicates a bug in skaterometr.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while skaterometr.exe has focus.
The output window may have more diagnostic information.
Dam 5+ temu kto to pomoże mi z tym problemem..
Dodam jeszcze że jak kontynuuje wykonywanie prgramu mimo błedu to dalej w tej funkcji deklaruje trzecią tablice gdzie błąd nie występuje , następnie deklaruje tablice trójwymiarową i bład równiez nie wystepuje... pojawia sie on tylko w tym jednym
miejscu.. bardzo proszę o pomoc.
n=0;
for( x=0 ; x<=2 ; x++)
{
tabpom[x]=0;
}
meas->wart_AngleOfIncidence = (int*)malloc(meas->AngleOfIncidence * sizeof *meas->wart_AngleOfIncidence);
do { // wartosci angle of incidence
c = getc (plik1);
if (c == '0'|| c=='1' || c=='2' ||c=='3' || c=='4' || c=='5' || c=='6' || c=='7' || c=='8' || c== '9' && n<=2)
{
n++;
if(n==1) tabpom[0]=c;
if(n==2) tabpom[1]=c;
}
if (c==9 || c=='\n' && n != 0)
{
i++;
n=0;
pomocnicza=atoi(tabpom);
meas->wart_AngleOfIncidence[i]=pomocnicza ;
printf("%d ", meas->wart_AngleOfIncidence[i]);
for( x=0 ; x<=2 ; x++)
{
tabpom[x]=0;
}
}
} while (c != '\n');
for( x=0 ; x<=2 ; x++)
{
tabpom[x]=0;
}
printf("\n");
do { // ScatterAzimuth
c = getc (plik1);
if (c == '0'|| c=='1' || c=='2' ||c=='3' || c=='4' || c=='5' || c=='6' || c=='7' || c=='8' || c== '9' )
{
n++;
if(n==1) tabpom[0]=c;
if(n==2) tabpom[1]=c;
if(n==3) tabpom[2]=c;
}
} while (c != '\n');
meas->ScatterAzimuth = atoi(tabpom);
printf("\nScatterAzimuth - %d\n", meas->ScatterAzimuth );
meas->wart_ScatterAzimuth = calloc(meas->ScatterAzimuth , sizeof(int)); // TUTAJ BŁĄD !!!!! :(
n=0;
pomocnicza=0 ;
i=0;
for( x=0 ; x<=2 ; x++)
{
tabpom[x]=0;
}
i=0;
do { // wart_ScatterAzimuth
c = getc (plik1);
if (c == '0'|| c=='1' || c=='2' ||c=='3' || c=='4' || c=='5' || c=='6' || c=='7' || c=='8' || c== '9' && n<=2)
{
n++;
if(n==1) tabpom[0]=c;
if(n==2) tabpom[1]=c;
if(n==3) tabpom[2]=c;
}
if (c==9 || c=='\n' && n != 0)
{
n=0;
pomocnicza=atoi(tabpom);
meas->wart_ScatterAzimuth[i]=pomocnicza ;
i++;
if(i==13)
{
printf("\n");
}
printf("%d ", meas->wart_ScatterAzimuth[i]);
for( x=0 ; x<=2 ; x++)
{
tabpom[x]=0;
}
}
} while (c != '\n');