Hi, I'm trying to run the simple included program, but I receive that error: Internal error: string capacity cannot be negative. I have noticed that the problem start on readln inside the loop. Is there a way to overcome that? Window95, gpc version 2.53.
Thanks for your help. Paolo Cortelli
program txt2rec; type rmaterie = record m_materia:string[18]; m_esclude:string[78]; m_len: integer; m_esc: array[1..5] of integer; end; tmaterie = array[0..0] of rmaterie; pmaterie = ^tmaterie;
var k,len_m: integer; materie: pmaterie; f: text;
procedure p_mat(fl:string); begin assign(f,fl); reset(f); readln(f,len_m); getmem(materie,sizeof(rmaterie)*len_m); for k := 1 to len_m do readln(f,materie^[k].m_materia,materie^[k].m_esclude); close(f); freemem(materie,sizeof(rmaterie)*len_m); end;
begin p_mat('materie.txt'); end.
{ This is the contents of MATERIE.TXT
36 BIOLOGIA \LAB.BIOLOG CALCOLO \LAB.CALCOLO CHIMICA \LAB.CHIMICA }