diff --git a/gnuradio-core/src/lib/io/gr_file_sink.cc b/gnuradio-core/src/lib/io/gr_file_sink.cc index aab0158..52d4c84 100644 --- a/gnuradio-core/src/lib/io/gr_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_file_sink.cc @@ -27,6 +27,8 @@ #include #include #include +#include +#include gr_file_sink_sptr @@ -64,9 +66,16 @@ gr_file_sink::work (int noutput_items, return noutput_items; // drop output on the floor while (nwritten < noutput_items){ + errno=0; int count = fwrite (inbuf, d_itemsize, noutput_items - nwritten, d_fp); - if (count == 0) // FIXME add error handling + if (count == EOF){ // FIXME add error handling + //printf("fwrite() returned EOF. Requested %d and wrote %d\n",noutput_items - nwritten,count); break; + } + if (errno!=0){ // FIXME add error handling + //printf("fwrite() raised error no = %d. Requested %d and wrote %d\n",errno,noutput_items - nwritten,count); + break; + } nwritten += count; inbuf += count * d_itemsize; }