SetStreamPosition[stream,n]
sets the current point in an open stream.
SetStreamPosition
SetStreamPosition[stream,n]
sets the current point in an open stream.
Details
- The integer n given to SetStreamPosition should usually be a value obtained from StreamPosition.
- SetStreamPosition[stream,0] sets the current point to the beginning of a stream.
- SetStreamPosition[stream,Infinity] sets the current point to the end of a stream.
Examples
Basic Examples (1)
str = StringToStream["123 456 789"]Read the first number from the stream object:
Read[str, Number]Modify the current point in the stream:
SetStreamPosition[str, 7]Read a number from the stream object:
Read[str, Number]Close[str]See Also
Tech Notes
Related Guides
History
Introduced in 1991 (2.0)
Text
Wolfram Research (1991), SetStreamPosition, Wolfram Language function, https://reference.wolfram.com/language/ref/SetStreamPosition.html.
CMS
Wolfram Language. 1991. "SetStreamPosition." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SetStreamPosition.html.
APA
Wolfram Language. (1991). SetStreamPosition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetStreamPosition.html
BibTeX
@misc{reference.wolfram_2026_setstreamposition, author="Wolfram Research", title="{SetStreamPosition}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/SetStreamPosition.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_setstreamposition, organization={Wolfram Research}, title={SetStreamPosition}, year={1991}, url={https://reference.wolfram.com/language/ref/SetStreamPosition.html}, note=[Accessed: 13-June-2026]}