diff --git a/inputsource.cpp b/inputsource.cpp index a1538f9..9c5b3d8 100644 --- a/inputsource.cpp +++ b/inputsource.cpp @@ -13,16 +13,16 @@ InputSource::InputSource(const char *filename, int fft_size) { m_file = fopen(filename, "rb"); if (m_file == nullptr) - throw "Error opening file"; + throw std::runtime_error("Error opening file"); struct stat sb; if (fstat(fileno(m_file), &sb) != 0) - throw "Error fstating file"; + throw std::runtime_error("Error fstating file"); m_file_size = sb.st_size; m_data = (fftwf_complex*)mmap(NULL, m_file_size, PROT_READ, MAP_SHARED, fileno(m_file), 0); if (m_data == 0) - throw "Error mmapping file"; + throw std::runtime_error("Error mmapping file"); m_fftw_in = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * m_fft_size); m_fftw_out = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * m_fft_size); diff --git a/main.cpp b/main.cpp index 12c50ea..3bc652f 100644 --- a/main.cpp +++ b/main.cpp @@ -53,8 +53,8 @@ bool MyApp::OnInit() try { m_input_source = new InputSource(argv[1], fft_size); - } catch (const char *msg) { - printf("%s\n", msg); + } catch (std::exception const& msg) { + printf("%s\n", msg.what()); return false; }