juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Wed May 13, 2015 4:56 pm Post subject: Retrieve data from a file (other alternative) |
|
|
I tried another way to retrieve data from a file.
I know the "traditional" way, but I tried for other alternative to be learning.
| Code: |
proc noti_nolist {nick uhost handle chan arg} {
global canal_admin
if {[string tolower $chan] != [string tolower $canal_admin]} {
return
}
if {[file exist prohibidos.txt]} {
set file [open prohibidos.txt "r"]
set x 0
while {![eof $file]} {
set nickpr [gets $file]
if {([llength $nickpr] == 0) && ($x == 0)} { putmsg $chan "The list is empty."; return }
if {$nickpr == ""} { continue }
putmsg $chan "$nickpr"
set x [expr {$x + 1}]
}
close $file
putmsg $chan "The list contains $x prohibited nicks."
} else {
putmsg $canal_admin "Has not yet entered any nick,database is missing.!"
}
} |
Works well!  _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|