T jest ok
type
Trec = record
tytul: string[255];
tresc: string[255];
end;
var
plik: file of Trec;
rec: Trec;
Jednak gdybym chciał tresc: string[1255]; lub tresc:ansistring;
to już nie przejdzie idzie to ominąć
T jest ok
type
Trec = record
tytul: string[255];
tresc: string[255];
end;
var
plik: file of Trec;
rec: Trec;
Jednak gdybym chciał tresc: string[1255]; lub tresc:ansistring;
to już nie przejdzie idzie to ominąć
Spróbuj
array[1..1250] of char;
Spróbuj
array[1..1250] of char;
tyle że wtedy bede miał problem przypisac zawartość memo do takiej tablicy
to zapisz kilka stringów i już :)
tyle że wtedy bede miał problem przypisac zawartość memo do takiej tablicy
Chciałbym mieć takie problemy !
var
s: string;
i: integer;
Arr: array[0..1250] of Char;
begin
s := Memo1.Text;
for i := 1 to Length(s) do
begin
if i > Length(Arr) - 1 then Break;
Arr[i - 1] := s[i];
end;
end;
już lepiej tak: ;p
var
s: string;
i,len: integer;
Arr: array[1..1250] of Char;
begin
s:= Memo1.Text;
len:=Length(s);
if len>1250 Then len:=1250;
for i := 1 to len do
Arr[i] := s[i];
end;
a w drugą strone
S:=String(arr);
jack, Szymek:
T jest ok
type
Trec = record
tytul: string[255];
tresc: string[255];
end;
var
plik: file of Trec;
rec: Trec;
Jednak gdybym chciał tresc: string[1255]; lub tresc:ansistring;
to już nie przejdzie idzie to ominąć
TRec = record
Tytul: string[255];
Tresc: array[0..1254] of Char;
end;
Teraz pole Tresc jest kompatybilne z łańcuchami PChar (przy włączonej dyrektywie $X, ale jest to ustawienie domyślne), więc nie powinno być problemu z przypisaniem zwykłego stringa (ale tablica musi być indeksowana od zera!).