Skip to content
Prev 11539 / 398502 Next

Read to the end of a stream (package Rstreams)

Sven Garbade <garbade at psy.uni-muenchen.de> writes:
Yes, but not like that. s does not have the position and size
components; only summary(s) has those. So

while (summary(s)$position < summary(s)$size) {...}

would do it (note: at "==", you're at the end). However, it would be
more natural to use the fact that readint returns numeric(0) on EOF:

while ( length(type <- readint(s, 1, 2)) )
{
	...
}