OpenersNotesSection(Spacer1)Details

This message is generated when the value of the second argument in (RefLink[SetStreamPosition, paclet:ref/SetStreamPosition]) corresponds to a position that is outside of the stream specified in the first argument.

(RefLink[Off, paclet:ref/Off])[message] switches off the message; (RefLink[On, paclet:ref/On])[message] switches it on. For example: (RefLink[Off, paclet:ref/Off])[SetStreamPosition::stmrng].

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

An error occurs because the position specified in (RefLink[SetStreamPosition, paclet:ref/SetStreamPosition]) exceeds the number of characters in the test file:

Write["TESTFILE",OutputForm["ABCDEFGHOJKLMNOP"]]

Close["TESTFILE"]

With[{s=OpenRead["TESTFILE"]},
SetStreamPosition[s,100];
Print["char 101 = ",Read[s,Character]];
Close[s]
]

This shows a valid position specification for this file:

With[{s=OpenRead["TESTFILE"]},
SetStreamPosition[s,10];
Print["char 11 = ",Read[s,Character]];
Close[s]
]

Delete the test file:

DeleteFile["TESTFILE"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SetStreamPosition, paclet:ref/SetStreamPosition])}})}})