#108528 - 2003-11-20 03:33 PM
Read File content
|
@lejo @rias
Starting to like KiXtart
Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
|
Hi, I have a file like this
last.cfg
log_size=1024000 udp_interval=300 udp_attempts=6 login_interval=1800 lcs.machine_name=bmded15juarias0grlot lcs.crypt_mode=196608 lcfd_alternate_port=9496
I need look in this file the line lcs.machine_name= And save in a variable the content of this line for example:
lcs.machine_name=bmded15juarias0grlot $lcsname="bmded15juarias0grlot"
how do this??? tks PD: pls I canīt use functions but if is necesary....
_________________________
Look always 4 the best...
|
|
Top
|
|
|
|
#108530 - 2003-11-20 03:49 PM
Re: Read File content
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
If you decide to use UDFs, see ReadFile() and FilterArray()
|
|
Top
|
|
|
|
#108531 - 2003-11-20 04:55 PM
Re: Read File content
|
@lejo @rias
Starting to like KiXtart
Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
|
Iīm a starter and I make this script, but donīt work, Can u helpme pls? Code:
Function FilterArray($array,$find, optional $inclusive) Dim $lf, $t, $l, $sp $lf=Chr(10) $sp=Chr(32) If NOT VarType($Array) & 8192 Exit(1) EndIf For Each $l In $array If (InStr($l,$find) AND $inclusive AND Trim($l)> $sp) OR (NOT InStr($l,$find) AND NOT $inclusive AND Trim($l)> $sp) $t=$t+$lf+$l EndIf Next $FilterArray=Split(SubStr($t,2),$lf) EndFunction
Function ReadFile($file) Dim $lf, $f, $_, $t $lf=Chr(10) $f=FreeFileHandle $_=Open($f,$file) If @error Exit @error EndIf Do $t=$t+$lf+ReadLine($f) Until @error $_=Close($f) $ReadFile=Split(SubStr($t,2),$lf) EndFunction
$tivfile=ReadFile(c:\temp\last.cfg) $tivarray=FilterArray($tivfile,"lcs.machine_name") ?$tivarray
_________________________
Look always 4 the best...
|
|
Top
|
|
|
|
#108532 - 2003-11-20 05:01 PM
Re: Read File content
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
$tivarray=FilterArray($tivfile,"lcs.machine_name") for each $item in $tivarray ? $item next
|
|
Top
|
|
|
|
#108534 - 2003-11-20 05:44 PM
Re: Read File content
|
@lejo @rias
Starting to like KiXtart
Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
|
$tivarray=FilterArray($tivfile,"lcs.machine_name", 1 )
now works that I need... tks all
_________________________
Look always 4 the best...
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2924 anonymous users online.
|
|
|