From: SourceForge.net <no...@so...> - 2006-03-16 23:06:01
|
Feature Requests item #787960, was opened at 2003-08-13 03:45 Message generated for change (Comment added) made by andreas_kupries You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=360894&aid=787960&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 24. Channel Commands Group: None Status: Open Resolution: None Priority: 7 Submitted By: Nobody/Anonymous (nobody) Assigned to: Andreas Kupries (andreas_kupries) Summary: read all-or-nothing option Initial Comment: Since tcl's underlying I/O system seems to support this already, it would be handy if read had an "all-or-nothing" option which, when used with a channel in non-blocking mode, causes read to return data only when the specified number of bytes are available for reading. If insufficient data is available, it returns nothing. This is in contrast to the normal mode of operation in which the available characters are returned even if less than the number requested. Suggestion submitted by Mario Becroft <mb...@ge...> ---------------------------------------------------------------------- >Comment By: Andreas Kupries (andreas_kupries) Date: 2006-03-16 15:05 Message: Logged In: YES user_id=75003 While I like the idea of [read -xxx 8] for xxx the name of the option, I am not sure that I understand the need for an additional option -yyy for the granularity. I want the 8-byte integer, I say [read -xxx 8] ... Ah. Wait. you might wish to read an array of 8-byte integer, eh ? Say, 10 of them. And instead of writing [read -xxx 80], or even [read -xxx [expr {10*8}]] (well, with appropriate variables, you (dkf) are thinking about [read -xxx -yyy 8 10]. And the default for -yyy is 1, i.e. bytes. In this context [read -all-or-nothing -size 8 10]. Ok. ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2003-10-29 01:19 Message: Logged In: YES user_id=79902 I like this idea; perhaps it would be best done as an option to [read]? It might also be nice to have an option to get data in a certain granularity, so that you can guarantee (for example) that you only ever get complete 8-byte integers suitable for feeding into [binary scan]. Sure you can work around this sort of thing, but it is a pain and can easily be done in Tcl's channel layer since you've already got something like that for handling encodings and the reading of lines... It's a good and simplifying suggestion, so boosting the Prio ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=360894&aid=787960&group_id=10894 |