# File sink issue

**URL:** <https://www.ruby-forum.com/t/file-sink-issue/219895>\
**Category:** GNU Radio\
**Created:** [May 21, 2012, 9:20am UTC](https://www.ruby-forum.com/t/file-sink-issue/219895 "2012-05-21T09:20:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 21, 2012, 9:20am UTC](https://www.ruby-forum.com/t/file-sink-issue/219895/1 "2012-05-21T09:20:08Z")

</div>

Sir

I am trying to build an SID SDR receiver,where i require a file sink…  
When i run my flow graph,i get a file of format octet-stream being  
written  
into my computer.  
But i am not able to access or open my dat octet-stream file.  
Sir may i know how can i access the data being written into it?

Thank you

---

<div class="post-metadata">

**Author:** ![ambily\_joseph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/47e85d/32.png) [@ambily\_joseph](https://www.ruby-forum.com/u/ambily_joseph)\
**Post date:** [May 21, 2012, 4:15pm UTC](https://www.ruby-forum.com/t/file-sink-issue/219895/2 "2012-05-21T16:15:48Z")

</div>

On Mon, May 21, 2012 at 12:19 AM, ambily joseph [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

The file sink is just a dump of the data stream. If the data stream  
content was simple bytes then the content of the file is  
straightforward. If the data stream contained complex numbers then the  
file will contain a list of complex numbers where each complex number  
is given by two floats and each float by (usually) 4 bytes.

See the files gnuradio/gnuradio-core/src/lib/io/gr\_file\_sink.cc and  
gr\_file\_source.cc for the implementations of the gnuradio file reading  
and writing blocks.

You could also use python and gnuradio to convert the files into some  
other format.

from gnuradio import gr

# Assuming the data stream was complex numbers.

src = gr.file\_source(gr.sizeof\_gr\_complex, “the\_file\_name”)  
snk = gr.vector\_sink\_c()  
tb = gr.top\_block()  
tb.connect(src, snk)  
tb.run()

# The complex numbers are then accessible as a python list.

data = snk.data()

Ben

---

<div class="post-metadata">

**Author:** ![ambily\_joseph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/47e85d/32.png) [@ambily\_joseph](https://www.ruby-forum.com/u/ambily_joseph)\
**Post date:** [May 24, 2012, 12:52pm UTC](https://www.ruby-forum.com/t/file-sink-issue/219895/3 "2012-05-24T12:52:29Z")

</div>

It depends what you mean by readable format. If you just want to get  
an idea of the values and the file isn’t to big then do:

from gnuradio import gr  
src = gr.file\_source(1, “the\_file\_name”)  
snk = gr.vector\_sink\_b()  
tb = gr.top\_block()  
tb.connect(src, snk)  
tb.run()

# The bytes will be presented as a list of integers in python.

data = snk.data()  
print(data)
