File ->Huge amount of data - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

File ->Huge amount of data

porodoroporodoro Posts: 230Member
[b][red]This message was edited by porodoro at 2007-1-2 21:16:41[/red][/b][hr]
[b][red]This message was edited by porodoro at 2007-1-2 21:16:2[/red][/b][hr]
Hi again.
I need a way to read/write alot of data in a file.
Tini doesnt help , because of the 64kb limitation.
Tmemini doesnt help either(8.000 characters per line).

My idea:

I have a function that extracts data from two strings.
for example :

2
The function will extract the number "2".

And my question is : Can i use the normal read file funtion to read the data in a temporary string list?
(note:the program will read each line)
Something like this:

list := tstringlist.create
list.clear
while (not EOF) do begin
list.add(readln(f))
end;
or just : list.loadfromfile()

for i=0 to list.count-1 do begin
GET_DATA(list.strings[i],'','')
end
list.free

Or its a bad idea ?






Comments

  • zibadianzibadian Posts: 6,349Member
    : [b][red]This message was edited by porodoro at 2007-1-2 21:16:41[/red][/b][hr]
    : [b][red]This message was edited by porodoro at 2007-1-2 21:16:2[/red][/b][hr]
    : Hi again.
    : I need a way to read/write alot of data in a file.
    : Tini doesnt help , because of the 64kb limitation.
    : Tmemini doesnt help either(8.000 characters per line).
    :
    : My idea:
    :
    : I have a function that extracts data from two strings.
    : for example :
    :
    : 2
    : The function will extract the number "2".
    :
    : And my question is : Can i use the normal read file funtion to read the data in a temporary string list?
    : (note:the program will read each line)
    : Something like this:
    :
    : list := tstringlist.create
    : list.clear
    : while (not EOF) do begin
    : list.add(readln(f))
    : end;
    : or just : list.loadfromfile()
    :
    : for i=0 to list.count-1 do begin
    : GET_DATA(list.strings[i],'','')
    : end
    : list.free
    :
    : Or its a bad idea ?
    :
    It is a good idea, if you use the LoadFromFile(). This only works if the file isn't bigger than 2GB. For larger files, you need to use a TStream and process the file while reading.

  • porodoroporodoro Posts: 230Member
    : : [b][red]This message was edited by porodoro at 2007-1-2 21:16:41[/red][/b][hr]
    : : [b][red]This message was edited by porodoro at 2007-1-2 21:16:2[/red][/b][hr]
    : : Hi again.
    : : I need a way to read/write alot of data in a file.
    : : Tini doesnt help , because of the 64kb limitation.
    : : Tmemini doesnt help either(8.000 characters per line).
    : :
    : : My idea:
    : :
    : : I have a function that extracts data from two strings.
    : : for example :
    : :
    : : 2
    : : The function will extract the number "2".
    : :
    : : And my question is : Can i use the normal read file funtion to read the data in a temporary string list?
    : : (note:the program will read each line)
    : : Something like this:
    : :
    : : list := tstringlist.create
    : : list.clear
    : : while (not EOF) do begin
    : : list.add(readln(f))
    : : end;
    : : or just : list.loadfromfile()
    : :
    : : for i=0 to list.count-1 do begin
    : : GET_DATA(list.strings[i],'','')
    : : end
    : : list.free
    : :
    : : Or its a bad idea ?
    : :
    : It is a good idea, if you use the LoadFromFile(). This only works if the file isn't bigger than 2GB. For larger files, you need to use a TStream and process the file while reading.
    :
    :
    I dont think i;ll ever need 2gb , but thanks for the information..

  • porodoroporodoro Posts: 230Member
    Something that i forgot.
    The max character length per line is 255?(like string)
  • zibadianzibadian Posts: 6,349Member
    : Something that i forgot.
    : The max character length per line is 255?(like string)
    :
    Since D3, there are 2 string types: shortstring and longstring. Shortstring is the same as the Pascal string (array of 256 char, with length in 1st char). Longstring is a complex structure capable of containing strings up to 2GB (theoretically). Longstrings are reference counted and have a storage similar to the PChar.
  • porodoroporodoro Posts: 230Member
    : : Something that i forgot.
    : : The max character length per line is 255?(like string)
    : :
    : Since D3, there are 2 string types: shortstring and longstring. Shortstring is the same as the Pascal string (array of 256 char, with length in 1st char). Longstring is a complex structure capable of containing strings up to 2GB (theoretically). Longstrings are reference counted and have a storage similar to the PChar.
    :
    Ok thanks for the information
Sign In or Register to comment.