Wolfram Computation Meets Knowledge

OpenStreamQ

Contributed by: Taliesin Beynon

Test if a stream is open.

ResourceFunction["OpenStreamQ"][stream]

returns True if stream is opened and False otherwise.

Examples

Basic Examples

Test if a stream is open:

In[1]:=
str = StringToStream["abc efg hij"]
Out[1]=
In[2]:=
ResourceFunction["OpenStreamQ"][str]
Out[2]=
In[3]:=
Close[str]
Out[3]=
In[4]:=
ResourceFunction["OpenStreamQ"][str]
Out[4]=

Open another stream:

In[5]:=
stmp = OpenWrite["tmp"]
Out[5]=
In[6]:=
ResourceFunction["OpenStreamQ"][stmp]
Out[6]=
In[7]:=
Close[stmp]
Out[7]=

Resource History