I want to save some data as a text file, the first txt file will contain header information, the other text file will save data streamed from sensors, so with the help from the internet I created the following "datalogger.cpp" file

Qt Code:
  1. #include "datalogger.h"
  2. #include <QDebug>
  3. #include <iostream>
  4. #include <QFile>
  5.  
  6. DataLogger::DataLogger(QObject *parent) : QObject(parent)
  7. {
  8.  
  9. }
  10.  
  11. DataLogger::~DataLogger(){
  12.  
  13. }
  14. void DataLogger::save(DataStream &input){
  15. saveAsText(input);
  16.  
  17.  
  18. }
  19. void DataLogger::saveAsText(DataStream &input){
  20.  
  21. QTextStream outHeader(&outFileHeader);
  22.  
  23. outHeader << "[CAPTURE SETTINGS]\n"
  24. << "Filename: " << SettingsSingleton::instance().getFileName() << ".txt \n"
  25. << "Samples: " << QString::number(input.size()) << "\n"
  26. << "Duration: " << QString::number(input.back().time) << "ms \n"
  27. << "Sample rate: " << QString::number(SettingsSingleton::instance().getSampleRate()) << " Hz\n"
  28. << "Source: " << SettingsSingleton::instance().getSource() << "\n"
  29.  
  30. outFileHeader.close();
  31.  
  32. }
  33.  
  34. QFile outFile(SettingsSingleton::instance().getFileName() + ".txt");
  35.  
  36. QTextStream out(&outFile);
  37.  
  38. for (int i ; i<input.size();i++){
  39. const EcgStreamObject tmp=input.at(i);
  40. out << tmp.toText() << endl; //"\n";
  41.  
  42. }
  43.  
  44. outFile.close();
  45. }
  46.  
  47. }
To copy to clipboard, switch view to plain text mode 

I have my "DataStream" input variable that I want to pass to the method and save as a ".txt" file, however I do no know how to call the method "void DataLogger::save(DataStream &input)" from a different ".cpp" file where the DataStream variable is located.
I am extremely new to c++ please it as simple as possible please.
Thank you in advance