# Stream data read from source file

**URL:** <https://www.ruby-forum.com/t/stream-data-read-from-source-file/263642>\
**Category:** GNU Radio\
**Created:** [February 7, 2023, 6:52pm UTC](https://www.ruby-forum.com/t/stream-data-read-from-source-file/263642 "2023-02-07T18:52:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nauritius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b3f665/32.png) [@nauritius](https://www.ruby-forum.com/u/nauritius)\
**Post date:** [February 7, 2023, 6:52pm UTC](https://www.ruby-forum.com/t/stream-data-read-from-source-file/263642/1 "2023-02-07T18:52:19Z")

</div>

Hi everyone, this is my first post here.  
My goal is to read data held in binary file, decode them and stream to block’s output. Data are just sequence of floats. Moreover I also have a sampling rate, at which they were collected (it is constant for all data). I have C++ OOT module, based on source, I managed to decode file and now I have a vector of floats. How to put them to the block’s output as a stream of floats?

```auto
int reader_impl::work(int noutput_items,
                               gr_vector_const_void_star& input_items,
                               gr_vector_void_star& output_items)
{
    auto out = static_cast<output_type*>(output_items[0]);
    auto size = noutput_items;
    static size_t current_data_item = 0;

    for (int i = 0; i < std::min(noutput_items, static_cast<int>(data.size())); ++i) {
        out[i] = static_cast<float>(data[current_data_item]);
        current_data_item++;
        if (current_data_item == data.size()) {
            current_data_item = 0;
        }
    }
    return noutput_items;
}

```
