Name
bsearch
- bsearch
fileId key
[retvar
] [compare_proc
] Search file opened with
fileId
for lines of text matching the stringkey
. Return the line that was found, or an empty string if no match exists. If the variable name is specified withretvar
, the matching line is stored in the variable and the command returns 1 if the key matched or 0 if there was no match. Can optionally specify a procedure compare_proc that will compare the key and each line, returning a value indicating the collation order (see ccollate).
Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.