Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
File ->Huge amount of data Posted by porodoro on 2 Jan 2007 at 9:15 PM
This message was edited by porodoro at 2007-1-2 21:16:41

This message was edited by porodoro at 2007-1-2 21:16:2

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 :

<counter>2</counter>
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],'<counter>','</counter>')
end
list.free

Or its a bad idea ?






Report
Re: File ->Huge amount of data Posted by zibadian on 2 Jan 2007 at 9:27 PM
: This message was edited by porodoro at 2007-1-2 21:16:41

: This message was edited by porodoro at 2007-1-2 21:16:2

: 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 :
:
: <counter>2</counter>
: 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],'<counter>','</counter>')
: 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.

Report
Re: File ->Huge amount of data Posted by porodoro on 3 Jan 2007 at 12:38 AM
: : This message was edited by porodoro at 2007-1-2 21:16:41

: : This message was edited by porodoro at 2007-1-2 21:16:2

: : 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 :
: :
: : <counter>2</counter>
: : 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],'<counter>','</counter>')
: : 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..

Report
Re: File ->Huge amount of data Posted by porodoro on 3 Jan 2007 at 11:19 AM
Something that i forgot.
The max character length per line is 255?(like string)
Report
Re: File ->Huge amount of data Posted by zibadian on 3 Jan 2007 at 11:30 AM
: 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.
Report
Re: File ->Huge amount of data Posted by porodoro on 8 Jan 2007 at 11:44 PM
: : 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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.