# readObject {#readobject}

**Parent topic:**[Functions](../../Functions/category.md)

## Syntax {#syntax}

`readObject(handle)`

## Arguments {#arguments}

**handle** is the handle of the object to read.

## Details {#details}

Can read all data structures including scalar, vector, matrix, set, dictionary and table to the handle. It must be executed by a logged-in user.

## Examples {#examples}

```
a1=10.5
a2=1..10
a3=cross(*,1..5,1..10)
a4=set(`IBM`MSFT`GOOG`YHOO)
a5=dict(a4.keys(),125.6 53.2 702.3 39.7)
a6=table(1 2 3 as id, `Jenny`Tom`Jack as name)
a7=(1 2 3, "hello world!", 25.6)

fout=file("test.bin","w")
fout.writeObject(a1)
fout.writeObject(a2)
fout.writeObject(a3)
fout.writeObject(a4)
fout.writeObject(a5)
fout.writeObject(a6)
fout.writeObject(a7)
fout.close();
```

The script above writes 7 different types of objects to a file. The script below reads out those 7 objects from the file and prints out a short description of the objects.

```
fin = file("test.bin")
for(i in 0:7) print typestr fin.readObject()
fin.close();
/* output:
 DOUBLE
 FAST INT VECTOR
 INT MATRIX
 STRING SET
 STRING->DOUBLE Dictionary
 TABLE
 ANY VECTOR
*/
```

