This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

file 2 list

Old posts that have not been replied to for several years.
Locked
S
Smokefoot

file 2 list

Post by Smokefoot »

Hi,
i want to make in script where i want to use an database (.dat).
Everyline is one entry. Now i want to convert the file into an list.

How can I make this?

Plz help
Thx
Smokefoot
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

set fid [open $file r]
while {![eof $fid]} {
  set line [gets $fid]
  lappend somelist $line
}
close $fid
Elen sila lúmenn' omentielvo
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Or you can use read and split

Code: Select all

set fp [open file.dat r]
set list [split [read -nonewline $fp] \n]
close $fp
Locked