Soucis proc
#3
Le bind je l'ai ajouter dans l'edition, je te joins à ce message le procfile

tcl
proc procfile {file action arg} {
    set arg [mbfilter $arg]
	set return 0
	set dbr [open database/$file.db r+]
	set dbw [open database/$file.tmp w+]
	while {![eof $dbr]} {
		set r [gets $dbr]
		if {$r!=""} {puts $dbw $r}
	}
	close $dbr
	close $dbw
	set dbr [open database/$file.tmp r+]
	set dbw [open database/$file.db w+]
	while {![eof $dbr]} {
		set r [gets $dbr]
		if {$action=="add"} {
			if {$r!=""} {
				puts $dbw $r
			} else {
				puts $dbw $arg
			}
			set return 1
		}
		if {$action=="del"} {
			if {$r!=""} {
				if {![string match -nocase $arg [lindex $r 0]] && ![string match -nocase $arg [lindex $r 1]]} {
					puts $dbw $r
				} else {
					set return 1
				}
			}
		}
		if {$action=="chk"} {
			if {$r!=""} {
				puts $dbw $r
				if [string match -nocase [lindex $arg 0] [lindex $r 1]] {
					set return [lindex $r 0]
					if ![string match -nocase [lindex $arg 1] [lindex $r 2]] {set return 2}
					if ![string match [lindex $arg 2] [lindex $r 3]] {set return 3}
				}
			}
		}
		if {$action=="icr"} {
			if {$r!=""} {
				puts $dbw $r
				if [string match -nocase $arg [lindex $r 0]] {
					set return 1
				}
			}
		}
		if {$action=="cf"} {
			if {$r!=""} {
				puts $dbw $r
				if [string match -nocase [lindex $r 0] $arg] {
					set return 1
				}
			}
		}
		if {$action=="ibr"} {
			if {$r!=""} {
				puts $dbw $r
				if [string match -nocase $arg [lindex $r 1]] {
					set return 1
				}
			}
		}
 
	}
	close $dbr
	close $dbw
	return $return
    }


Répondre Avertir


Messages dans ce sujet
Soucis proc - par Ixion - 25/03/2011, 20:51
RE: Soucis proc - par MenzAgitat - 25/03/2011, 21:00
RE: Soucis proc - par Ixion - 25/03/2011, 21:06
RE: Soucis proc - par Ixion - 26/03/2011, 00:13
RE: Soucis proc - par CrazyCat - 26/03/2011, 00:39
RE: Soucis proc - par Ixion - 26/03/2011, 00:54

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté