[PATCH v1] Reports: Convert to C++

Ryan Long ryan.long at oarcorp.com
Mon Jul 12 13:42:53 UTC 2021


---
 tester/covoar/ReportsBase.cc |  296 ++++++------
 tester/covoar/ReportsBase.h  |  118 +++--
 tester/covoar/ReportsHtml.cc | 1074 +++++++++++++++++-------------------------
 tester/covoar/ReportsHtml.h  |   94 ++--
 tester/covoar/ReportsText.cc |  261 +++++-----
 tester/covoar/ReportsText.h  |   34 +-
 6 files changed, 838 insertions(+), 1039 deletions(-)

diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc
index 328980d..7fd3422 100644
--- a/tester/covoar/ReportsBase.cc
+++ b/tester/covoar/ReportsBase.cc
@@ -4,6 +4,9 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <iomanip>
+#include <sstream>
+
 #include "ReportsBase.h"
 #include "app_common.h"
 #include "CoverageRanges.h"
@@ -20,7 +23,7 @@
 
 namespace Coverage {
 
-ReportsBase::ReportsBase( time_t timestamp, std::string symbolSetName ):
+ReportsBase::ReportsBase( time_t timestamp, const std::string& symbolSetName ):
   reportExtension_m(""),
   symbolSetName_m(symbolSetName),
   timestamp_m( timestamp )
@@ -31,13 +34,13 @@ ReportsBase::~ReportsBase()
 {
 }
 
-FILE* ReportsBase::OpenFile(
-  const char* const fileName,
-  const char* const symbolSetName
+void ReportsBase::OpenFile(
+  const std::string& fileName,
+  const std::string& symbolSetName,
+  std::ofstream&     aFile
 )
 {
   int          sc;
-  FILE        *aFile;
   std::string  file;
 
   std::string symbolSetOutputDirectory;
@@ -54,120 +57,131 @@ FILE* ReportsBase::OpenFile(
   sc = mkdir( symbolSetOutputDirectory.c_str(),0755 );
 #endif
   if ( (sc == -1) && (errno != EEXIST) ) {
-    fprintf(
-      stderr,
-      "Unable to create output directory %s\n",
-      symbolSetOutputDirectory.c_str()
+    throw rld::error(
+      "Unable to create output directory",
+      "ReportsBase::OpenFile"
     );
-    return NULL;
+    return;
   }
 
   file = symbolSetOutputDirectory;
   rld::path::path_join(file, fileName, file);
 
   // Open the file.
-  aFile = fopen( file.c_str(), "w" );
-  if ( !aFile ) {
-    fprintf( stderr, "Unable to open %s\n", file.c_str() );
+  aFile.open( file );
+  if ( !aFile.is_open() ) {
+    std::cerr << "Unable to open " << file << std::endl;
   }
-  return aFile;
+  return;
 }
 
 void ReportsBase::WriteIndex(
-  const char* const fileName
+  const std::string& fileName
 )
 {
 }
 
-FILE* ReportsBase::OpenAnnotatedFile(
-  const char* const fileName
+void ReportsBase::OpenAnnotatedFile(
+  const std::string& fileName,
+  std::ofstream&     aFile
 )
 {
-  return OpenFile(fileName, symbolSetName_m.c_str());
+  OpenFile(fileName, symbolSetName_m, aFile);
+  return;
 }
 
-FILE* ReportsBase::OpenBranchFile(
-  const char* const fileName,
-  bool              hasBranches
+void ReportsBase::OpenBranchFile(
+  const std::string& fileName,
+  bool               hasBranches,
+  std::ofstream&     aFile
 )
 {
-  return OpenFile(fileName, symbolSetName_m.c_str());
+  OpenFile(fileName, symbolSetName_m, aFile);
+  return;
 }
 
-FILE* ReportsBase::OpenCoverageFile(
-  const char* const fileName
+void ReportsBase::OpenCoverageFile(
+  const std::string& fileName,
+  std::ofstream&     aFile
 )
 {
-  return OpenFile(fileName, symbolSetName_m.c_str());
+  OpenFile(fileName, symbolSetName_m, aFile);
+  return;
 }
 
-FILE* ReportsBase::OpenNoRangeFile(
-  const char* const fileName
+void ReportsBase::OpenNoRangeFile(
+  const std::string& fileName,
+  std::ofstream&     aFile
 )
 {
-  return OpenFile(fileName, symbolSetName_m.c_str());
+  OpenFile(fileName, symbolSetName_m, aFile);
+  return;
 }
 
 
-FILE* ReportsBase::OpenSizeFile(
-  const char* const fileName
+void ReportsBase::OpenSizeFile(
+  const std::string& fileName,
+  std::ofstream&     aFile
 )
 {
-  return OpenFile(fileName, symbolSetName_m.c_str());
+  OpenFile(fileName, symbolSetName_m, aFile);
+  return;
 }
 
-FILE* ReportsBase::OpenSymbolSummaryFile(
-  const char* const fileName
+void ReportsBase::OpenSymbolSummaryFile(
+  const std::string& fileName,
+  std::ofstream&     aFile
 )
 {
-  return OpenFile(fileName, symbolSetName_m.c_str());
+  OpenFile(fileName, symbolSetName_m, aFile);
+  return;
 }
 
 void ReportsBase::CloseFile(
-  FILE*  aFile
+  std::ofstream& aFile
 )
 {
-  fclose( aFile );
+  aFile.close();
 }
 
 void ReportsBase::CloseAnnotatedFile(
-  FILE*  aFile
+  std::ofstream& aFile
 )
 {
   CloseFile( aFile );
 }
 
 void ReportsBase::CloseBranchFile(
-  FILE*  aFile,
-  bool   hasBranches
+  std::ofstream& aFile,
+  bool           hasBranches
 )
 {
   CloseFile( aFile );
 }
 
 void  ReportsBase::CloseCoverageFile(
-  FILE*  aFile
+  std::ofstream& aFile
 )
 {
   CloseFile( aFile );
 }
 
 void  ReportsBase::CloseNoRangeFile(
-  FILE*  aFile
+  std::ofstream& aFile
 )
 {
   CloseFile( aFile );
 }
 
 void  ReportsBase::CloseSizeFile(
-  FILE*  aFile
+  std::ofstream& aFile
 )
 {
   CloseFile( aFile );
 }
 
 void  ReportsBase::CloseSymbolSummaryFile(
-  FILE*  aFile
+  std::ofstream& aFile
 )
 {
   CloseFile( aFile );
@@ -195,18 +209,23 @@ std::string expand_tabs(const std::string& in) {
  *  Write annotated report
  */
 void ReportsBase::WriteAnnotatedReport(
-  const char* const fileName
+  const std::string& fileName
 ) {
-  FILE*                      aFile = NULL;
+  std::ofstream              aFile;
   Coverage::CoverageRanges*  theBranches;
   Coverage::CoverageRanges*  theRanges;
   Coverage::CoverageMapBase* theCoverageMap = NULL;
   uint32_t                   bAddress = 0;
   AnnotatedLineState_t       state;
 
-  aFile = OpenAnnotatedFile(fileName);
-  if (!aFile)
+  OpenAnnotatedFile(fileName, aFile);
+  if (!aFile.is_open()) {
+    throw rld::error(
+      "Unable to open " + fileName,
+      "ReportsBase::WriteAnnotatedReport"
+    );
     return;
+  }
 
   // Process uncovered branches for each symbol.
   const std::vector<std::string>& symbols = SymbolsToAnalyze->getSymbolsForSet(symbolSetName_m);
@@ -238,7 +257,8 @@ void ReportsBase::WriteAnnotatedReport(
       std::string        annotation = "";
       std::string        line;
       const std::size_t  LINE_LENGTH = 150;
-      char               textLine[LINE_LENGTH];
+      std::string        textLine = "";
+      std::stringstream  ss;
 
       state = A_SOURCE;
 
@@ -264,7 +284,12 @@ void ReportsBase::WriteAnnotatedReport(
       }
 
       std::string textLineWithoutTabs = expand_tabs(instruction.line);
-      snprintf( textLine, LINE_LENGTH, "%-90s", textLineWithoutTabs.c_str() );
+
+      ss << std::left << std::setw( 90 )
+         << textLineWithoutTabs.c_str();
+
+      textLine = ss.str().substr( 0, LINE_LENGTH );
+
       line = textLine + annotation;
 
       PutAnnotatedLine( aFile, state, line, id);
@@ -280,9 +305,9 @@ void ReportsBase::WriteAnnotatedReport(
  *  Write branch report
  */
 void ReportsBase::WriteBranchReport(
-  const char* const fileName
+  const std::string& fileName
 ) {
-  FILE*                     report = NULL;
+  std::ofstream             report;
   Coverage::CoverageRanges* theBranches;
   unsigned int              count;
   bool                      hasBranches = true;
@@ -292,8 +317,8 @@ void ReportsBase::WriteBranchReport(
      hasBranches = false;
 
   // Open the branch report file
-  report = OpenBranchFile( fileName, hasBranches );
-  if (!report)
+  OpenBranchFile( fileName, hasBranches, report );
+  if (!report.is_open())
     return;
 
   // If no branches were found then branch coverage is not supported
@@ -324,26 +349,26 @@ void ReportsBase::WriteBranchReport(
  *  Write coverage report
  */
 void ReportsBase::WriteCoverageReport(
-  const char* const fileName
+  const std::string& fileName
 )
 {
-  FILE*                     report;
+  std::ofstream             report;
   Coverage::CoverageRanges* theRanges;
   unsigned int              count;
-  FILE*                     NoRangeFile;
+  std::ofstream             NoRangeFile;
   std::string               NoRangeName;
 
   // Open special file that captures NoRange informaiton
   NoRangeName = "no_range_";
   NoRangeName +=  fileName;
-  NoRangeFile = OpenNoRangeFile ( NoRangeName.c_str() );
-  if (!NoRangeFile) {
+  OpenNoRangeFile( NoRangeName, NoRangeFile );
+  if ( !NoRangeFile.is_open() ) {
     return;
   }
 
   // Open the coverage report file.
-  report = OpenCoverageFile( fileName );
-  if ( !report ) {
+  OpenCoverageFile( fileName, report );
+  if ( !report.is_open() ) {
     return;
   }
 
@@ -380,16 +405,16 @@ void ReportsBase::WriteCoverageReport(
  * Write size report
  */
 void ReportsBase::WriteSizeReport(
-  const char* const fileName
+  const std::string& fileName
 )
 {
-  FILE*                     report;
+  std::ofstream             report;
   Coverage::CoverageRanges* theRanges;
   unsigned int              count;
 
   // Open the report file.
-  report = OpenSizeFile( fileName );
-  if ( !report ) {
+  OpenSizeFile( fileName, report );
+  if ( !report.is_open() ) {
     return;
   }
 
@@ -414,15 +439,15 @@ void ReportsBase::WriteSizeReport(
 }
 
 void ReportsBase::WriteSymbolSummaryReport(
-  const char* const fileName
+  const std::string& fileName
 )
 {
-  FILE*                                           report;
+  std::ofstream                                   report;
   unsigned int                                    count;
 
   // Open the report file.
-  report = OpenSymbolSummaryFile( fileName );
-  if ( !report ) {
+  OpenSymbolSummaryFile( fileName , report );
+  if ( !report.is_open() ) {
     return;
   }
 
@@ -441,8 +466,8 @@ void ReportsBase::WriteSymbolSummaryReport(
 }
 
 void  ReportsBase::WriteSummaryReport(
-  const char* const fileName,
-  const char* const symbolSetName
+  const std::string& fileName,
+  const std::string& symbolSetName
 )
 {
     // Calculate coverage statistics and output results.
@@ -453,11 +478,11 @@ void  ReportsBase::WriteSummaryReport(
   double                                          percentageBranches;
   Coverage::CoverageMapBase*                      theCoverageMap;
   uint32_t                                        totalBytes = 0;
-  FILE*                                           report;
+  std::ofstream                                   report;
 
   // Open the report file.
-  report = OpenFile( fileName, symbolSetName );
-  if ( !report ) {
+  OpenFile( fileName, symbolSetName, report );
+  if ( !report.is_open() ) {
     return;
   }
 
@@ -497,64 +522,45 @@ void  ReportsBase::WriteSummaryReport(
     (double) SymbolsToAnalyze->getNumberBranchesFound(symbolSetName) * 2;
   percentageBranches *= 100.0;
 
-  fprintf( report, "Bytes Analyzed                   : %d\n", totalBytes );
-  fprintf( report, "Bytes Not Executed               : %d\n", notExecuted );
-  fprintf( report, "Percentage Executed              : %5.4g\n", 100.0 - percentage  );
-  fprintf( report, "Percentage Not Executed          : %5.4g\n", percentage  );
-  fprintf(
-    report,
-    "Unreferenced Symbols             : %d\n",
-    SymbolsToAnalyze->getNumberUnreferencedSymbols(symbolSetName)
-  );
-  fprintf(
-    report,
-    "Uncovered ranges found           : %d\n\n",
-    SymbolsToAnalyze->getNumberUncoveredRanges(symbolSetName)
-  );
+  report << "Bytes Analyzed                   : " << totalBytes << std::endl
+         << "Bytes Not Executed               : " << notExecuted << std::endl
+         << "Percentage Executed              : "
+         << std::fixed << std::setprecision( 2 ) << std::setw( 5 )
+         << 100.0 - percentage << std::endl
+         << "Percentage Not Executed          : " << percentage << std::endl
+         << "Unreferenced Symbols             : "
+         << SymbolsToAnalyze->getNumberUnreferencedSymbols( symbolSetName )
+         << std::endl << "Uncovered ranges found           : "
+         << SymbolsToAnalyze->getNumberUncoveredRanges( symbolSetName )
+         << std::endl << std::endl;
+
   if ((SymbolsToAnalyze->getNumberBranchesFound(symbolSetName) == 0) ||
       (BranchInfoAvailable == false) ) {
-    fprintf( report, "No branch information available\n" );
+    report << "No branch information available" << std::endl;
   } else {
-    fprintf(
-      report,
-      "Total conditional branches found : %d\n",
-      SymbolsToAnalyze->getNumberBranchesFound(symbolSetName)
-    );
-    fprintf(
-      report,
-      "Total branch paths found         : %d\n",
-      SymbolsToAnalyze->getNumberBranchesFound(symbolSetName) * 2
-    );
-    fprintf(
-      report,
-      "Uncovered branch paths found     : %d\n",
-      SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName) +
-       SymbolsToAnalyze->getNumberBranchesNeverTaken(symbolSetName) +
-       (SymbolsToAnalyze->getNumberBranchesNotExecuted(symbolSetName) * 2)
-    );
-    fprintf(
-      report,
-      "   %d branches always taken\n",
-      SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName)
-    );
-    fprintf(
-      report,
-      "   %d branches never taken\n",
-      SymbolsToAnalyze->getNumberBranchesNeverTaken(symbolSetName)
-    );
-    fprintf(
-      report,
-      "   %d branch paths not executed\n",
-      SymbolsToAnalyze->getNumberBranchesNotExecuted(symbolSetName) * 2
-    );
-    fprintf(
-      report,
-      "Percentage branch paths covered  : %4.4g\n",
-      100.0 - percentageBranches
-    );
+
+    report << "Total conditional branches found : "
+           << SymbolsToAnalyze->getNumberBranchesFound( symbolSetName )
+           << std::endl << "Total branch paths found         : "
+           << SymbolsToAnalyze->getNumberBranchesFound( symbolSetName ) * 2
+           << std::endl << "Uncovered branch paths found     : "
+           << SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName) +
+              SymbolsToAnalyze->getNumberBranchesNeverTaken(symbolSetName) +
+             (SymbolsToAnalyze->getNumberBranchesNotExecuted(symbolSetName) * 2)
+           << std::endl << "   "
+           << SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName)
+           << " branches always taken" << std::endl << "   "
+           << SymbolsToAnalyze->getNumberBranchesNeverTaken(symbolSetName)
+           << " branches never taken" << std::endl << "   "
+           << SymbolsToAnalyze->getNumberBranchesNotExecuted(symbolSetName) * 2
+           << " branch paths not executed" << std::endl
+           << "Percentage branch paths covered  : "
+           << std::fixed << std::setprecision(2) << std::setw(4)
+           << 100.0 - percentageBranches << std::endl;
+
   }
 
-  fclose( report );
+  CloseFile( report );
 }
 
 void GenerateReports(const std::string& symbolSetName)
@@ -580,45 +586,33 @@ void GenerateReports(const std::string& symbolSetName)
 
     reportName = "index" + reports->ReportExtension();
     if (Verbose)
-      fprintf(
-        stderr, "Generate %s\n", reportName.c_str()
-      );
-    reports->WriteIndex( reportName.c_str() );
+      std::cerr << "Generate " << reportName << std::endl;
+    reports->WriteIndex( reportName );
 
     reportName = "annotated" + reports->ReportExtension();
     if (Verbose)
-      fprintf(
-        stderr, "Generate %s\n", reportName.c_str()
-      );
-    reports->WriteAnnotatedReport( reportName.c_str() );
+      std::cerr << "Generate " << reportName << std::endl;
+    reports->WriteAnnotatedReport( reportName );
 
     reportName = "branch" + reports->ReportExtension();
     if (Verbose)
-      fprintf(
-        stderr, "Generate %s\n", reportName.c_str()
-      );
-    reports->WriteBranchReport(reportName.c_str() );
+      std::cerr << "Generate " << reportName << std::endl;
+    reports->WriteBranchReport( reportName );
 
     reportName = "uncovered" + reports->ReportExtension();
     if (Verbose)
-      fprintf(
-        stderr, "Generate %s\n", reportName.c_str()
-      );
-    reports->WriteCoverageReport(reportName.c_str() );
+      std::cerr << "Generate " << reportName << std::endl;
+    reports->WriteCoverageReport( reportName );
 
     reportName = "sizes" + reports->ReportExtension();
     if (Verbose)
-      fprintf(
-        stderr, "Generate %s\n", reportName.c_str()
-      );
-    reports->WriteSizeReport(reportName.c_str() );
+    std::cerr << "Generate " << reportName << std::endl;
+    reports->WriteSizeReport( reportName );
 
     reportName = "symbolSummary" + reports->ReportExtension();
     if (Verbose)
-      fprintf(
-        stderr, "Generate %s\n", reportName.c_str()
-      );
-    reports->WriteSymbolSummaryReport(reportName.c_str() );
+      std::cerr << "Generate " << reportName << std::endl;
+    reports->WriteSymbolSummaryReport( reportName );
   }
 
   for (ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
@@ -626,7 +620,7 @@ void GenerateReports(const std::string& symbolSetName)
     delete reports;
   }
 
-  ReportsBase::WriteSummaryReport( "summary.txt", symbolSetName.c_str() );
+  ReportsBase::WriteSummaryReport( "summary.txt", symbolSetName );
 }
 
 }
diff --git a/tester/covoar/ReportsBase.h b/tester/covoar/ReportsBase.h
index ab8f8dd..ed381fb 100644
--- a/tester/covoar/ReportsBase.h
+++ b/tester/covoar/ReportsBase.h
@@ -11,6 +11,8 @@
 
 #include <stdint.h>
 #include <string>
+#include <iostream>
+#include <fstream>
 #include <time.h>
 #include "DesiredSymbols.h"
 
@@ -24,7 +26,7 @@ namespace Coverage {
 class ReportsBase {
 
   public:
-    ReportsBase( time_t timestamp, std::string symbolSetName );
+    ReportsBase( time_t timestamp, const std::string& symbolSetName );
     virtual ~ReportsBase();
 
     /*!
@@ -33,7 +35,7 @@ class ReportsBase {
      *  @param[in] fileName identifies the report file name
      */
     virtual void WriteIndex(
-      const char* const fileName
+      const std::string& fileName
     );
 
     /*!
@@ -43,7 +45,7 @@ class ReportsBase {
      *  @param[in] fileName identifies the annotated report file name
      */
     void WriteAnnotatedReport(
-      const char* const fileName
+      const std::string& fileName
     );
 
     /*!
@@ -53,7 +55,7 @@ class ReportsBase {
      *  @param[in] fileName identifies the branch report file name
      */
     void WriteBranchReport(
-      const char* const fileName
+      const std::string& fileName
     );
 
     /*!
@@ -63,7 +65,7 @@ class ReportsBase {
      *  @param[in] fileName identifies the coverage report file name
      */
     void WriteCoverageReport(
-      const char* const fileName
+      const std::string& fileName
     );
 
     /*!
@@ -73,7 +75,7 @@ class ReportsBase {
      *  @param[in] fileName identifies the report file name
      */
     void WriteSizeReport(
-      const char* const fileName
+      const std::string& fileName
     );
 
     /*!
@@ -83,15 +85,15 @@ class ReportsBase {
      *  @param[in] fileName identifies the report file name
      */
     void WriteSymbolSummaryReport(
-      const char* const fileName
+      const std::string& fileName
     );
 
     /*!
      *  This method produces a sumary report for the overall test run.
      */
     static void  WriteSummaryReport(
-      const char* const fileName,
-      const char* const symbolSetName
+      const std::string& fileName,
+      const std::string& symbolSetName
     );
 
     /*!
@@ -135,10 +137,12 @@ class ReportsBase {
      *
      *  @param[in] fileName identifies the report file name
      *  @param[in] symbolSetName identifies the name of the report's symbol set
+     *  @param[in] aFile identifies the file to open
      */
-     static FILE* OpenFile(
-      const char* const fileName,
-      const char* const symbolSetName
+    static void OpenFile(
+      const std::string& fileName,
+      const std::string& symbolSetName,
+      std::ofstream&     aFile
     );
 
     /*!
@@ -146,9 +150,11 @@ class ReportsBase {
      *  Then appedns any necessary header information onto the file.
      *
      *  @param[in] fileName identifies the report file name
+     *  @param[in] aFile identifies the file to open
      */
-    virtual FILE* OpenAnnotatedFile(
-      const char* const fileName
+    virtual void OpenAnnotatedFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /*!
@@ -157,10 +163,12 @@ class ReportsBase {
      *
      *  @param[in] fileName identifies the report file name
      *  @param[in] hasBranches indicates if there are branches to report
+     *  @param[in] aFile identifies the file to open
      */
-    virtual FILE* OpenBranchFile(
-      const char* const fileName,
-      bool              hasBranches
+    virtual void OpenBranchFile(
+      const std::string& fileName,
+      bool               hasBranches,
+      std::ofstream&     aFile
     );
 
     /*!
@@ -168,9 +176,11 @@ class ReportsBase {
      *  Then appedns any necessary header information onto the file.
      *
      *  @param[in] fileName identifies the report file name
+     *  @param[in] aFile identifies the file to open
      */
-    virtual FILE* OpenCoverageFile(
-      const char* const fileName
+    virtual void OpenCoverageFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /*!
@@ -178,9 +188,11 @@ class ReportsBase {
      *  Then appends any necessary header information onto the file.
      *
      *  @param[in] fileName identifies the report file name
+     *  @param[in] aFile identifies the file to open
      */
-    virtual FILE* OpenNoRangeFile(
-      const char* const fileName
+    virtual void OpenNoRangeFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /*!
@@ -188,9 +200,11 @@ class ReportsBase {
      *  Then appedns any necessary header information onto the file.
      *
      *  @param[in] fileName identifies the report file name
+     *  @param[in] aFile identifies the file to open
      */
-    virtual FILE* OpenSizeFile(
-      const char* const fileName
+    virtual void OpenSizeFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /*!
@@ -198,39 +212,41 @@ class ReportsBase {
      *  Then appedns any necessary header information onto the file.
      *
      *  @param[in] fileName identifies the report file name
+     *  @param[in] aFile identifies the file to open
      */
-    virtual FILE* OpenSymbolSummaryFile(
-      const char* const fileName
+    virtual void OpenSymbolSummaryFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /*!
      *  This method Closes a report file.
      *
-     *  @param[in] aFile identifies the report file name
+     *  @param[in] aFile identifies the file to close
      */
     static void CloseFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /*!
      *  This method puts any necessary footer information into
      *  the report then closes the file.
      *
-     *  @param[in] aFile identifies the report file name
+     *  @param[in] aFile identifies the file to close
      */
     virtual void CloseAnnotatedFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /*!
      *  This method puts any necessary footer information into
      *  the report then closes the file.
      *
-     *  @param[in] aFile identifies the report file name
+     *  @param[in] aFile identifies the file to close
      *  @param[in] hasBranches indicates if there are branches to report
      */
     virtual void CloseBranchFile(
-      FILE*  aFile,
+      std::ofstream& aFile,
       bool   hasBranches
     );
 
@@ -238,40 +254,40 @@ class ReportsBase {
      *  This method puts any necessary footer information into
      *  the report then closes the file.
      *
-     *  @param[in] aFile identifies the report file name
+     *  @param[in] aFile identifies the file to close
      */
     virtual void CloseCoverageFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /*!
      *  This method puts any necessary footer information into
      *  the report then closes the file.
      *
-     *  @param[in] aFile identifies the report file name
+     *  @param[in] aFile identifies the file to close
      */
     void  CloseNoRangeFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /*!
      *  This method puts any necessary footer information into
      *  the report then closes the file.
      *
-     *  @param[in] aFile identifies the report file name
+     *  @param[in] aFile identifies the file to close
      */
     virtual void CloseSizeFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /*!
      *  This method puts any necessary footer information into
      *  the report then closes the file.
      *
-     *  @param[in] aFile identifies the report file name
+     *  @param[in] aFile identifies the file to close
      */
     virtual void CloseSymbolSummaryFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /*!
@@ -284,9 +300,9 @@ class ReportsBase {
      *  @param[in] id identifies the branch or range id.
      */
     virtual void PutAnnotatedLine(
-      FILE*                aFile,
+      std::ofstream&       aFile,
       AnnotatedLineState_t state,
-      std::string          line,
+      const std::string&   line,
       uint32_t             id
     )=0;
 
@@ -297,7 +313,7 @@ class ReportsBase {
      *  @param[in] aFile identifies the report file name
      */
      virtual void AnnotatedStart(
-      FILE*                aFile
+      std::ofstream& aFile
     )=0;
 
     /*!
@@ -307,7 +323,7 @@ class ReportsBase {
      *  @param[in] aFile identifies the report file name
      */
      virtual void AnnotatedEnd(
-      FILE*                aFile
+      std::ofstream& aFile
     )=0;
 
 
@@ -318,7 +334,7 @@ class ReportsBase {
      *  @param[in] report identifies the report file name
      */
     virtual bool PutNoBranchInfo(
-      FILE* report
+      std::ofstream& report
     ) = 0;
 
     /*!
@@ -331,7 +347,7 @@ class ReportsBase {
      *  @param[in] range is the range information.
      */
     virtual bool PutBranchEntry(
-      FILE*                                            report,
+      std::ofstream&                                   report,
       unsigned int                                     number,
       const std::string&                               symbolName,
       const SymbolInformation&                         symbolInfo,
@@ -347,10 +363,10 @@ class ReportsBase {
      *  @param[in] symbol is a pointer to the symbol information
      */
     virtual void putCoverageNoRange(
-      FILE*        report,
-      FILE*        noRangeFile,
+      std::ofstream&     report,
+      std::ofstream&     noRangeFile,
       unsigned int number,
-      std::string  symbol
+      const std::string& symbol
     )=0;
 
     /*!
@@ -363,7 +379,7 @@ class ReportsBase {
      *  @param[in] range is the range information.
      */
     virtual bool PutCoverageLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const SymbolInformation&                        symbolInfo,
@@ -379,7 +395,7 @@ class ReportsBase {
      *  @param[in] range is the range information.
      */
     virtual bool PutSizeLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const CoverageRanges::coverageRange_t&          range
@@ -394,7 +410,7 @@ class ReportsBase {
      *  @param[in] symbolInfo is the symbol's information.
      */
     virtual bool PutSymbolSummaryLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const SymbolInformation&                        symbolInfo
diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
index fe75cdd..f9bd21f 100644
--- a/tester/covoar/ReportsHtml.cc
+++ b/tester/covoar/ReportsHtml.cc
@@ -2,6 +2,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <sstream>
+#include <iomanip>
+
 #include <rld.h>
 
 #include "ReportsHtml.h"
@@ -25,13 +28,13 @@
    "</tr>\n" \
    "</tfoot>\n"
 #else
-#define TABLE_HEADER_CLASS
-#define TABLE_FOOTER
+#define TABLE_HEADER_CLASS ""
+#define TABLE_FOOTER ""
 #endif
 
 namespace Coverage {
 
-  ReportsHtml::ReportsHtml( time_t timestamp, std::string symbolSetName ):
+  ReportsHtml::ReportsHtml( time_t timestamp, const std::string& symbolSetName ):
     ReportsBase( timestamp, symbolSetName )
   {
     reportExtension_m = ".html";
@@ -42,63 +45,46 @@ namespace Coverage {
   }
 
   void ReportsHtml::WriteIndex(
-    const char* const fileName
+    const std::string& fileName
   )
   {
+    std::ofstream aFile;
     #define PRINT_ITEM( _t, _n ) \
-       fprintf( \
-         aFile, \
-         "<li>%s (<a href=\"%s.html\">html</a> or "\
-         "<a href=\"%s.txt\">text</a>)</li>\n", \
-        _t, _n, _n );
+       aFile << "<li>" \
+             << _t << " (<a href=\"" \
+             << _n << ".html\">html</a> or <a href=\"" \
+             << _n << ".txt\">text</a>)</li>" << std::endl;
     #define PRINT_TEXT_ITEM( _t, _n ) \
-       fprintf( \
-         aFile, \
-         "<li>%s (<a href=\"%s\">text</a>)</li>\n", \
-        _t, _n );
+       aFile << "<li>" \
+             << _t << " (<a href=\"" \
+             << _n << "\">text</a>)</li>" << std::endl;
 
-    FILE*  aFile;
 
     // Open the file
-    aFile = OpenFile( fileName );
+    OpenFile(fileName, aFile);
 
-    fprintf(
-      aFile,
-      "<title>Index</title>\n"
-      "<div class=\"heading-title\">"
-    );
+    aFile << "<title>Index</title>" << std::endl
+          << "<div class=\"heading-title\">";
 
     if (projectName)
-      fprintf(
-        aFile,
-         "%s<br>",
-         projectName
-      );
-
-    fprintf(
-      aFile,
-      "Coverage Analysis Reports</div>\n"
-      "<div class =\"datetime\">%s</div>\n",
-      asctime( localtime(&timestamp_m) )
-    );
+      aFile << projectName << "<br>";
 
-    fprintf( aFile, "<ul>\n" );
+    aFile << "Coverage Analysis Reports</div>" << std::endl
+          << "<div class =\"datetime\">"
+          <<  asctime( localtime( &timestamp_m ) ) << "</div>" << std::endl
+          << "<ul>" << std::endl;
 
-    PRINT_TEXT_ITEM( "Summary",         "summary.txt" );
-    PRINT_ITEM( "Coverage Report",      "uncovered" );
-    PRINT_ITEM( "Branch Report",        "branch" );
-    PRINT_ITEM( "Annotated Assembly",   "annotated" );
-    PRINT_ITEM( "Symbol Summary",       "symbolSummary" );
-    PRINT_ITEM( "Uncovered Range Size Report",          "sizes" );
+    PRINT_TEXT_ITEM( "Summary",                     "summary.txt" );
+    PRINT_ITEM(      "Coverage Report",             "uncovered" );
+    PRINT_ITEM(      "Branch Report",               "branch" );
+    PRINT_ITEM(      "Annotated Assembly",          "annotated" );
+    PRINT_ITEM(      "Symbol Summary",              "symbolSummary" );
+    PRINT_ITEM(      "Uncovered Range Size Report", "sizes" );
+    PRINT_TEXT_ITEM( "Explanations Not Found",      "ExplanationsNotFound.txt" );
 
-    PRINT_TEXT_ITEM( "Explanations Not Found", "ExplanationsNotFound.txt" );
-
-    fprintf(
-      aFile,
-      "</ul>\n"
-      "<!-- INSERT PROJECT SPECIFIC ITEMS HERE -->\n"
-      "</html>\n"
-    );
+    aFile << "</ul>" << std::endl
+          << "<!-- INSERT PROJECT SPECIFIC ITEMS HERE -->" << std::endl
+          << "</html>" << std::endl;
 
     CloseFile( aFile );
 
@@ -106,332 +92,273 @@ namespace Coverage {
     #undef PRINT_TEXT_ITEM
   }
 
-  FILE* ReportsHtml::OpenFile(
-    const char* const fileName
+  void ReportsHtml::OpenFile(
+    const std::string& fileName,
+    std::ofstream&     aFile
   )
   {
-    FILE*  aFile;
-
     // Open the file
-    aFile = ReportsBase::OpenFile( fileName, symbolSetName_m.c_str() );
+    ReportsBase::OpenFile(fileName, symbolSetName_m, aFile);
 
     // Put Header information on the file
-    fprintf(
-      aFile,
-      "<html>\n"
-      "<meta http-equiv=\"Content-Language\" content=\"English\" >\n"
-      "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" >\n"
-      "<link rel=\"stylesheet\" type=\"text/css\" href=\"../covoar.css\" media=\"screen\" >\n"
-      "<script type=\"text/javascript\" src=\"../table.js\"></script>\n"
-    );
-
-    return aFile;
+    aFile << "<html>" << std::endl
+          << "<meta http-equiv=\"Content-Language\" content=\"English\" >"
+          << std::endl
+          << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" >"
+          << std::endl
+          << "<link rel=\"stylesheet\" type=\"text/css\" href=\"../covoar.css\" media=\"screen\" >"
+          << std::endl
+          << "<script type=\"text/javascript\" src=\"../table.js\"></script>"
+          << std::endl;
   }
 
-  FILE* ReportsHtml::OpenAnnotatedFile(
-    const char* const fileName
+  void ReportsHtml::OpenAnnotatedFile(
+    const std::string& fileName,
+    std::ofstream&     aFile
   )
   {
-    FILE *aFile;
-
     // Open the file
-    aFile = OpenFile(fileName);
+    OpenFile(fileName, aFile);
 
-    fprintf(
-      aFile,
-      "<title>Annotated Report</title>\n"
-      "<div class=\"heading-title\">"
-    );
+    aFile << "<title>Annotated Report</title>" << std::endl
+          << "<div class=\"heading-title\">";
 
     if (projectName)
-      fprintf(
-        aFile,
-         "%s<br>",
-         projectName
-      );
-
-    fprintf(
-      aFile,
-      "Annotated Report</div>\n"
-      "<div class =\"datetime\">%s</div>\n"
-      "<body>\n"
-      "<pre class=\"code\">\n",
-      asctime( localtime(&timestamp_m) )
-    );
+      aFile << projectName << "<br>";
 
-    return aFile;
+    aFile << "Annotated Report</div>" << std::endl
+          << "<div class =\"datetime\">"
+          << asctime( localtime( &timestamp_m ) ) << "</div>" << std::endl
+          << "<body>" << std::endl
+          << "<pre class=\"code\">" << std::endl;
   }
 
-  FILE* ReportsHtml::OpenBranchFile(
-    const char* const fileName,
-    bool              hasBranches
+  void ReportsHtml::OpenBranchFile(
+    const std::string& fileName,
+    bool               hasBranches,
+    std::ofstream&     aFile
   )
   {
-    FILE *aFile;
-
     // Open the file
-    aFile = OpenFile(fileName);
+    OpenFile(fileName, aFile);
 
     // Put header information into the file
-    fprintf(
-      aFile,
-      "<title>Branch Report</title>\n"
-      "<div class=\"heading-title\">"
-    );
+    aFile << "<title>Branch Report</title>" << std::endl
+          << "<div class=\"heading-title\">";
 
     if (projectName)
-      fprintf(
-        aFile,
-        "%s<br>",
-        projectName
-      );
-
-    fprintf(
-      aFile,
-      "Branch Report</div>\n"
-      "<div class =\"datetime\">%s</div>\n"
-      "<body>\n"
-      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
-          TABLE_HEADER_CLASS "\">\n"
-      "<thead>\n"
-      "<tr>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
-      "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n"
-      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Taken</th>\n"
-      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Not Taken</th>\n"
-      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
-      "</tr>\n"
-      "</thead>\n"
-      "<tbody>\n",
-      asctime( localtime(&timestamp_m) )
-    );
-
-    return aFile;
+      aFile << projectName << "<br>";
+
+    aFile << "Branch Report</div>" << std::endl
+          << "<div class =\"datetime\">"
+          << asctime( localtime( &timestamp_m ) ) << "</div>" << std::endl
+          << "<body>" << std::endl
+          << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
+          << TABLE_HEADER_CLASS << "\">" << std::endl
+          << "<thead>" << std::endl
+          << "<tr>" << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>" << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Line</th>"
+          << std::endl
+          << "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>"
+          << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Reason</th>"
+          << std::endl
+          << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Taken</th>"
+          << std::endl
+          << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Not Taken</th>"
+          << std::endl
+          << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>"
+          << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>"
+          << std::endl
+          << "</tr>" << std::endl
+          << "</thead>" << std::endl
+          << "<tbody>" << std::endl;
   }
 
-  FILE*  ReportsHtml::OpenCoverageFile(
-    const char* const fileName
+  void  ReportsHtml::OpenCoverageFile(
+    const std::string& fileName,
+    std::ofstream&     aFile
   )
   {
-    FILE *aFile;
-
     // Open the file
-    aFile = OpenFile(fileName);
+    OpenFile(fileName, aFile);
 
     // Put header information into the file
-    fprintf(
-      aFile,
-        "<title>Coverage Report</title>\n"
-        "<div class=\"heading-title\">"
-    );
+    aFile << "<title>Coverage Report</title>" << std::endl
+          << "<div class=\"heading-title\">";
 
     if (projectName)
-      fprintf(
-        aFile,
-        "%s<br>",
-        projectName
-      );
-
-    fprintf(
-      aFile,
-       "Coverage Report</div>\n"
-       "<div class =\"datetime\">%s</div>\n"
-       "<body>\n"
-       "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
-           TABLE_HEADER_CLASS "\">\n"
-      "<thead>\n"
-      "<tr>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Range</th>\n"
-      "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Instructions</th>\n"
-      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
-      "</tr>\n"
-      "</thead>\n"
-      "<tbody>\n",
-        asctime( localtime(&timestamp_m) )
-
-     );
-
-    return aFile;
+      aFile << projectName << "<br>";
+
+    aFile << "Coverage Report</div>" << std::endl
+          << "<div class =\"datetime\">"
+          << asctime( localtime( &timestamp_m ) ) << "</div>" << std::endl
+          << "<body>" << std::endl
+          << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
+          << TABLE_HEADER_CLASS << "\">" << std::endl
+          << "<thead>" << std::endl
+          << "<tr>" << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>"
+          << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Range</th>"
+          << std::endl
+          << "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Instructions</th>"
+          << std::endl
+          << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>"
+          << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>"
+          << std::endl
+          << "</tr>" << std::endl
+          << "</thead>" << std::endl
+          << "<tbody>" << std::endl;
   }
 
-  FILE* ReportsHtml::OpenNoRangeFile(
-    const char* const fileName
+  void ReportsHtml::OpenNoRangeFile(
+    const std::string& fileName,
+    std::ofstream&     aFile
   )
   {
-    FILE *aFile;
-
     // Open the file
-    aFile = OpenFile(fileName);
+    OpenFile(fileName, aFile);
 
     // Put header information into the file
-    fprintf(
-      aFile,
-        "<title> Report</title>\n"
-        "<div class=\"heading-title\">"
-    );
+    aFile << "<title> Report</title>" << std::endl
+          << "<div class=\"heading-title\">";
 
     if (projectName)
-      fprintf(
-        aFile,
-        "%s<br>",
-        projectName
-      );
-
-    fprintf(
-      aFile,
-       "No Range Report</div>\n"
-       "<div class =\"datetime\">%s</div>\n"
-        "<body>\n"
-      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
-           TABLE_HEADER_CLASS "\">\n"
-      "<thead>\n"
-      "<tr>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
-      "</tr>\n"
-      "</thead>\n"
-      "<tbody>\n",
-        asctime( localtime(&timestamp_m) )
-
-     );
-
-    return aFile;
+      aFile << projectName << "<br>";
+
+    aFile << "No Range Report</div>" << std::endl
+          << "<div class =\"datetime\">"
+          << asctime( localtime( &timestamp_m ) ) << "</div>" << std::endl
+          << "<body>" << std::endl
+          << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
+          << TABLE_HEADER_CLASS << "\">" << std::endl
+          << "<thead>" << std::endl
+          << "<tr>" << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>"
+          << std::endl
+          << "</tr>" << std::endl
+          << "</thead>" << std::endl
+          << "<tbody>" << std::endl;
    }
 
 
 
-  FILE*  ReportsHtml::OpenSizeFile(
-    const char* const fileName
+  void ReportsHtml::OpenSizeFile(
+    const std::string& fileName,
+    std::ofstream&     aFile
   )
   {
-    FILE *aFile;
-
     // Open the file
-    aFile = OpenFile(fileName);
+    OpenFile(fileName, aFile);
 
     // Put header information into the file
-    fprintf(
-      aFile,
-      "<title>Uncovered Range Size Report</title>\n"
-        "<div class=\"heading-title\">"
-    );
+    aFile << "<title>Uncovered Range Size Report</title>" << std::endl
+          << "<div class=\"heading-title\">";
 
     if (projectName)
-      fprintf(
-        aFile,
-        "%s<br>",
-        projectName
-      );
-
-    fprintf(
-      aFile,
-      "Uncovered Range Size Report</div>\n"
-       "<div class =\"datetime\">%s</div>\n"
-      "<body>\n"
-      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
-           TABLE_HEADER_CLASS "\">\n"
-      "<thead>\n"
-      "<tr>\n"
-      "<th class=\"table-sortable:numeric\" align=\"left\">Size</th>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
-      "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
-      "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
-      "</tr>\n"
-      "</thead>\n"
-      "<tbody>\n",
-        asctime( localtime(&timestamp_m) )
-
-    );
-    return aFile;
+      aFile << projectName << "<br>";
+
+    aFile << "Uncovered Range Size Report</div>" << std::endl
+          << "<div class =\"datetime\">"
+          << asctime( localtime( &timestamp_m ) ) << "</div>" << std::endl
+          << "<body>" << std::endl
+          << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
+          << TABLE_HEADER_CLASS << "\">" << std::endl
+          << "<thead>" << std::endl
+          << "<tr>" << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"left\">Size</th>"
+          << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>"
+          << std::endl
+          << "<th class=\"table-sortable:default\" align=\"left\">Line</th>"
+          << std::endl
+          << "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>"
+          << std::endl
+          << "</tr>" << std::endl
+          << "</thead>" << std::endl
+          << "<tbody>" << std::endl;
   }
 
-  FILE*  ReportsHtml::OpenSymbolSummaryFile(
-    const char* const fileName
+  void ReportsHtml::OpenSymbolSummaryFile(
+    const std::string& fileName,
+    std::ofstream&     aFile
   )
   {
-    FILE *aFile;
-
     // Open the file
-    aFile = OpenFile(fileName);
+    OpenFile(fileName, aFile);
 
     // Put header information into the file
-    fprintf(
-      aFile,
-      "<title>Symbol Summary Report</title>\n"
-      "<div class=\"heading-title\">"
-    );
+    aFile << "<title>Symbol Summary Report</title>" << std::endl
+          << "<div class=\"heading-title\">";
 
     if (projectName)
-      fprintf(
-        aFile,
-        "%s<br>",
-        projectName
-      );
-
-    fprintf(
-      aFile,
-      "Symbol Summary Report</div>\n"
-       "<div class =\"datetime\">%s</div>\n"
-      "<body>\n"
-      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
-           TABLE_HEADER_CLASS "\">\n"
-      "<thead>\n"
-      "<tr>\n"
-      "<th class=\"table-sortable:default\" align=\"center\">Symbol</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Bytes</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Instr</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Ranges</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Bytes</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Instr</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Branches</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Always<br>Taken</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Never<br>Taken</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Instructions</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Bytes</th>\n"
-      "</tr>\n"
-      "</thead>\n"
-      "<tbody>\n",
-        asctime( localtime(&timestamp_m) )
-
-    );
-    return aFile;
+      aFile << projectName << "<br>";
+
+    aFile << "Symbol Summary Report</div>" << std::endl
+          << "<div class =\"datetime\">"
+          << asctime( localtime( &timestamp_m ) ) << "</div>" << std::endl
+          << "<body>" << std::endl
+          << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
+          << TABLE_HEADER_CLASS << "\">" << std::endl
+          << "<thead>" << std::endl
+          << "<tr>" << std::endl
+          << "<th class=\"table-sortable:default\" align=\"center\">Symbol</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Bytes</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Instr</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Ranges</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Bytes</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Instr</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Branches</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Always<br>Taken</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Never<br>Taken</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Instructions</th>"
+          << std::endl
+          << "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Bytes</th>"
+          << std::endl
+          << "</tr>" << std::endl
+          << "</thead>" << std::endl
+          << "<tbody>" << std::endl;
   }
 
-  void ReportsHtml::AnnotatedStart(
-    FILE*                aFile
-  )
+  void ReportsHtml::AnnotatedStart( std::ofstream& aFile )
   {
-    fprintf(
-      aFile,
-      "<hr>\n"
-    );
+    aFile << "<hr>" << std::endl;
   }
 
-  void ReportsHtml::AnnotatedEnd(
-    FILE*                aFile
-  )
+  void ReportsHtml::AnnotatedEnd( std::ofstream& aFile )
   {
   }
 
   void ReportsHtml::PutAnnotatedLine(
-    FILE*                aFile,
+    std::ofstream&       aFile,
     AnnotatedLineState_t state,
-    std::string          line,
+    const std::string&   line,
     uint32_t             id
   )
   {
     std::string stateText;
-    char        number[10];
-
+    std::string number;
 
-    sprintf(number,"%d", id);
+    number = std::to_string( id );
 
     // Set the stateText based upon the current state.
     switch (state) {
@@ -460,7 +387,7 @@ namespace Coverage {
         stateText += "\"></a><pre class=\"codeNeverTaken\">\n";
         break;
       default:
-        throw rld::error( "Unknown state", "ReportsHtml::PutAnnotatedLine");
+        throw rld::error("Unknown state", "ReportsHtml::PutAnnotatedLine");
         break;
     }
 
@@ -468,7 +395,7 @@ namespace Coverage {
     // format.  If it has changed close out the old format and open up the
     // new format.
     if ( state != lastState_m ) {
-      fprintf( aFile, "%s", stateText.c_str() );
+      aFile << stateText;
       lastState_m = state;
     }
 
@@ -477,27 +404,27 @@ namespace Coverage {
     // is only a '<' symbol.
     for (unsigned int i=0; i<line.size(); i++ ) {
       if ( line[i] == '<' )
-        fprintf( aFile, "<" );
+        aFile << "<";
       else
-        fprintf( aFile, "%c", line[i] );
+        aFile << line[i];
     }
-    fprintf( aFile, "\n");
+    aFile << std::endl;
   }
 
   bool ReportsHtml::PutNoBranchInfo(
-    FILE* report
+    std::ofstream& report
   )
   {
     if (BranchInfoAvailable &&
       SymbolsToAnalyze->getNumberBranchesFound(symbolSetName_m) != 0)
-      fprintf( report, "All branch paths taken.\n" );
+      report << "All branch paths taken." << std::endl;
     else
-      fprintf( report, "No branch information found.\n" );
+      report << "No branch information found." << std::endl;
     return true;
   }
 
   bool ReportsHtml::PutBranchEntry(
-    FILE*                                            report,
+    std::ofstream&                                   report,
     unsigned int                                     count,
     const std::string&                               symbolName,
     const SymbolInformation&                         symbolInfo,
@@ -513,124 +440,99 @@ namespace Coverage {
 
     // Mark the background color different for odd and even lines.
     if ( ( count%2 ) != 0 )
-      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
+      report << "<tr class=\"covoar-tr-odd\">\n";
     else
-      fprintf( report, "<tr>\n");
+      report << "<tr>" << std::endl;
 
     // symbol
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      symbolName.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << symbolName << "</td>" << std::endl;
 
     // line
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s</td>\n",
-      range.id,
-      range.lowSourceLine.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range"
+           << range.id << "\">"
+           << range.lowSourceLine << "</td>" << std::endl;
 
     // File
     i = range.lowSourceLine.find(":");
     temp =  range.lowSourceLine.substr (0, i);
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      temp.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << temp << "</td>" << std::endl;
 
     // Size in bytes
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-      range.highAddress - range.lowAddress + 1
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << range.highAddress - range.lowAddress + 1 << "</td>" << std::endl;
 
     // Reason Branch was uncovered
     if (range.reason ==
       Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN)
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">Always Taken</td>\n"
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">Always Taken</td>"
+             << std::endl;
     else if (range.reason ==
       Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN)
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">Never Taken</td>\n"
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">Never Taken</td>"
+             << std::endl;
 
     // Taken / Not taken counts
     lowAddress = range.lowAddress;
     bAddress = symbolInfo.baseAddress;
     theCoverageMap = symbolInfo.unifiedCoverageMap;
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-      theCoverageMap->getWasTaken( lowAddress - bAddress )
-    );
-        fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-      theCoverageMap->getWasNotTaken( lowAddress - bAddress )
-    );
+
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << theCoverageMap->getWasTaken( lowAddress - bAddress )
+           << "</td>" << std::endl
+           << "<td class=\"covoar-td\" align=\"center\">"
+           << theCoverageMap->getWasNotTaken( lowAddress - bAddress )
+           << "</td>" << std::endl;
 
     // See if an explanation is available and write the Classification and
     // the Explination Columns.
     explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
     if ( !explanation ) {
       // Write Classificationditr->second.baseAddress
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">NONE</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">No Explanation</td>"
+             << std::endl;
     } else {
-      char explanationFile[48];
-      sprintf( explanationFile, "explanation%d.html", range.id );
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%s</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">"
-        "<a href=\"%s\">Explanation</a></td>\n",
-        explanation->classification.c_str(),
-        explanationFile
-      );
-      WriteExplationFile( explanationFile, explanation );
+      std::stringstream explanationFile( "explanation" );
+      explanationFile << range.id << ".html";
+
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << explanation->classification << "</td>" << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">"
+             << "<a href=\"" << explanationFile.str()
+             << "\">Explanation</a></td>" << std::endl;
+
+      WriteExplanationFile( explanationFile.str(), explanation );
     }
 
-    fprintf( report, "</tr>\n");
+    report << "</tr>" << std::endl;
 
     return true;
   }
 
-  bool ReportsHtml::WriteExplationFile(
-    const char*                  fileName,
+  bool ReportsHtml::WriteExplanationFile(
+    const std::string&           fileName,
     const Coverage::Explanation* explanation
   )
   {
-    FILE* report;
+    std::ofstream report;
 
-    report = OpenFile( fileName );
+    OpenFile(fileName, report);
 
     for ( unsigned int i=0 ; i < explanation->explanation.size(); i++) {
-      fprintf(
-        report,
-        "%s\n",
-        explanation->explanation[i].c_str()
-      );
+      report << explanation->explanation[i] << std::endl;
     }
     CloseFile( report );
     return true;
   }
 
   void ReportsHtml::putCoverageNoRange(
-    FILE*         report,
-    FILE*         noRangeFile,
+    std::ofstream&     report,
+    std::ofstream&     noRangeFile,
     unsigned int  count,
-    std::string   symbol
+    const std::string& symbol
   )
   {
     Coverage::Explanation explanation;
@@ -646,64 +548,50 @@ namespace Coverage {
 
     // Mark the background color different for odd and even lines.
     if ( ( count%2 ) != 0 ){
-      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
-      fprintf( noRangeFile,  "<tr class=\"covoar-tr-odd\">\n");
+      report << "<tr class=\"covoar-tr-odd\">" << std::endl;
+      noRangeFile << "<tr class=\"covoar-tr-odd\">" << std::endl;
     } else {
-      fprintf( report, "<tr>\n");
-      fprintf( noRangeFile,  "<tr>\n");
+      report << "<tr>" << std::endl;
+      noRangeFile << "<tr>" << std::endl;
     }
 
     // symbol
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      symbol.c_str()
-    );
-    fprintf(
-      noRangeFile,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      symbol.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << symbol << "</td>" << std::endl;
+    noRangeFile << "<td class=\"covoar-td\" align=\"center\">"
+                << symbol << "</td>" << std::endl;
 
     // starting line
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-     );
+    report << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+           << std::endl;
 
     // file
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-     );
+    report << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+           << std::endl;
 
      // Size in bytes
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+           << std::endl;
 
     // Size in instructions
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+           << std::endl;
 
     // See if an explanation is available
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">Unknown</td>\n"
-      "<td class=\"covoar-td\" align=\"center\">"
-      "<a href=\"NotReferenced.html\">No data</a></td>\n"
-    );
-    WriteExplationFile( "NotReferenced.html", &explanation );
+    report << "<td class=\"covoar-td\" align=\"center\">Unknown</td>"
+           << std::endl
+           << "<td class=\"covoar-td\" align=\"center\">"
+           << "<a href=\"NotReferenced.html\">No data</a></td>"
+           << std::endl;
+
+    WriteExplanationFile( "NotReferenced.html", &explanation );
 
-    fprintf( report, "</tr>\n");
-    fprintf( noRangeFile, "</tr>\n");
+    report << "</tr>" << std::endl;
+    noRangeFile << "</tr>" << std::endl;
   }
 
   bool ReportsHtml::PutCoverageLine(
-    FILE*                                            report,
+    std::ofstream&                                   report,
     unsigned int                                     count,
     const std::string&                               symbolName,
     const SymbolInformation&                         symbolInfo,
@@ -715,83 +603,65 @@ namespace Coverage {
     int                            i;
 
     // Mark the background color different for odd and even lines.
-    if ( ( count%2 ) != 0 )
-      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
+    if ( ( count% 2) != 0 )
+      report << "<tr class=\"covoar-tr-odd\">" << std::endl;
     else
-      fprintf( report, "<tr>\n");
+      report << "<tr>" << std::endl;
 
     // symbol
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      symbolName.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << symbolName << "</td>" << std::endl;
 
     // Range
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s <br>%s</td>\n",
-      range.id,
-      range.lowSourceLine.c_str(),
-      range.highSourceLine.c_str()
-     );
+    report << "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range"
+           << range.id << "\">"
+           << range.lowSourceLine << " <br>"
+           << range.highSourceLine << "</td>" << std::endl;
 
     // File
     i = range.lowSourceLine.find(":");
     temp =  range.lowSourceLine.substr (0, i);
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      temp.c_str()
-    );
+
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << temp << "</td>" << std::endl;
 
     // Size in bytes
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-      range.highAddress - range.lowAddress + 1
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << range.highAddress - range.lowAddress + 1 << "</td>" << std::endl;
 
     // Size in instructions
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-      range.instructionCount
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << range.instructionCount << "</td>" << std::endl;
 
     // See if an explanation is available
     explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
     if ( !explanation ) {
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
-      );
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">NONE</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">No Explanation</td>"
+             << std::endl;
     } else {
-      char explanationFile[48];
-
-      sprintf( explanationFile, "explanation%d.html", range.id );
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%s</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">"
-        "<a href=\"%s\">Explanation</a></td>\n",
-        explanation->classification.c_str(),
-        explanationFile
-      );
-      WriteExplationFile( explanationFile, explanation );
+      std::stringstream explanationFile( "explanation" );
+
+      explanationFile << range.id << ".html";
+
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << explanation->classification << "</td>" << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">"
+             << "<a href=\""
+             << explanationFile.str() << "\">Explanation</a></td>"
+             << std::endl;
+
+      WriteExplanationFile( explanationFile.str(), explanation );
     }
 
-    fprintf( report, "</tr>\n");
+    report << "</tr>" << std::endl;
 
     return true;
   }
 
   bool  ReportsHtml::PutSizeLine(
-    FILE*                                           report,
+    std::ofstream&                                  report,
     unsigned int                                    count,
     const std::string&                              symbolName,
     const CoverageRanges::coverageRange_t&          range
@@ -802,48 +672,35 @@ namespace Coverage {
 
     // Mark the background color different for odd and even lines.
     if ( ( count%2 ) != 0 )
-      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
+      report << "<tr class=\"covoar-tr-odd\">" << std::endl;
     else
-      fprintf( report, "<tr>\n");
+      report << "<tr>" << std::endl;
 
     // size
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-      range.highAddress - range.lowAddress + 1
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << range.highAddress - range.lowAddress + 1 << "</td>" << std::endl;
 
     // symbol
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      symbolName.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << symbolName << "</td>" << std::endl;
 
     // line
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s</td>\n",
-      range.id,
-      range.lowSourceLine.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range"
+           << range.id << "\">"
+           << range.lowSourceLine << "</td>" << std::endl;
 
     // File
     i = range.lowSourceLine.find(":");
     temp =  range.lowSourceLine.substr (0, i);
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      temp.c_str()
-    );
-
-    fprintf( report, "</tr>\n");
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << temp << "</td>" << std::endl
+           << "</tr>" << std::endl;
 
     return true;
   }
 
   bool  ReportsHtml::PutSymbolSummaryLine(
-    FILE*                                           report,
+    std::ofstream&                                  report,
     unsigned int                                    count,
     const std::string&                              symbolName,
     const SymbolInformation&                        symbolInfo
@@ -852,216 +709,173 @@ namespace Coverage {
 
     // Mark the background color different for odd and even lines.
     if ( ( count%2 ) != 0 )
-      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
+      report << "<tr class=\"covoar-tr-odd\">" << std::endl;
     else
-      fprintf( report, "<tr>\n");
+      report << "<tr>" << std::endl;
 
     // symbol
-    fprintf(
-      report,
-      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
-      symbolName.c_str()
-    );
+    report << "<td class=\"covoar-td\" align=\"center\">"
+           << symbolName << "</td>" << std::endl;
 
     if (symbolInfo.stats.sizeInBytes == 0) {
       // The symbol has never been seen. Write "unknown" for all columns.
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl
+             << "<td class=\"covoar-td\" align=\"center\">unknown</td>"
+             << std::endl;
     } else {
       // Total Size in Bytes
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.sizeInBytes
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.sizeInBytes << "</td>" << std::endl;
 
       // Total Size in Instructions
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.sizeInInstructions
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.sizeInInstructions << "</td>" << std::endl;
 
       // Total Uncovered Ranges
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.uncoveredRanges
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.uncoveredRanges << "</td>" << std::endl;
 
       // Uncovered Size in Bytes
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.uncoveredBytes
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.uncoveredBytes << "</td>" << std::endl;
 
       // Uncovered Size in Instructions
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.uncoveredInstructions
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.uncoveredInstructions << "</td>" << std::endl;
 
       // Total number of branches
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.branchesNotExecuted + symbolInfo.stats.branchesExecuted
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.branchesNotExecuted +
+                symbolInfo.stats.branchesExecuted
+             << "</td>" << std::endl;
 
       // Total Always Taken
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.branchesAlwaysTaken
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.branchesAlwaysTaken << "</td>" << std::endl;
 
       // Total Never Taken
-      fprintf(
-        report,
-        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
-        symbolInfo.stats.branchesNeverTaken
-      );
+      report << "<td class=\"covoar-td\" align=\"center\">"
+             << symbolInfo.stats.branchesNeverTaken << "</td>" << std::endl;
 
       // % Uncovered Instructions
       if ( symbolInfo.stats.sizeInInstructions == 0 )
-        fprintf(
-          report,
-          "<td class=\"covoar-td\" align=\"center\">100.00</td>\n"
-        );
+        report << "<td class=\"covoar-td\" align=\"center\">100.00</td>"
+               << std::endl;
       else
-        fprintf(
-          report,
-          "<td class=\"covoar-td\" align=\"center\">%.2f</td>\n",
-          (symbolInfo.stats.uncoveredInstructions*100.0)/
-           symbolInfo.stats.sizeInInstructions
-        );
+        report << "<td class=\"covoar-td\" align=\"center\">"
+               << std::fixed << std::setprecision( 2 )
+               << ( symbolInfo.stats.uncoveredInstructions * 100.0 ) /
+                    symbolInfo.stats.sizeInInstructions
+               << "</td>" << std::endl;
 
       // % Uncovered Bytes
       if ( symbolInfo.stats.sizeInBytes == 0 )
-        fprintf(
-          report,
-          "<td class=\"covoar-td\" align=\"center\">100.00</td>\n"
-        );
+        report << "<td class=\"covoar-td\" align=\"center\">100.00</td>"
+               << std::endl;
       else
-        fprintf(
-          report,
-          "<td class=\"covoar-td\" align=\"center\">%.2f</td>\n",
-          (symbolInfo.stats.uncoveredBytes*100.0)/
-           symbolInfo.stats.sizeInBytes
-        );
+        report << "<td class=\"covoar-td\" align=\"center\">"
+               << ( symbolInfo.stats.uncoveredBytes * 100.0 ) /
+                    symbolInfo.stats.sizeInBytes
+               << "</td>" << std::endl;
     }
 
-    fprintf( report, "</tr>\n");
+    report << "</tr>" << std::endl;
     return true;
   }
 
   void ReportsHtml::CloseAnnotatedFile(
-    FILE*  aFile
+    std::ofstream& aFile
   )
   {
-    fprintf(
-      aFile,
-      "</pre>\n"
-      "</body>\n"
-      "</html>"
-    );
+    aFile << "</pre>"  << std::endl
+          << "</body>" << std::endl
+          << "</html>" << std::endl;
 
     CloseFile(aFile);
   }
 
   void ReportsHtml::CloseBranchFile(
-    FILE*  aFile,
+    std::ofstream& aFile,
     bool   hasBranches
   )
   {
-    fprintf(
-      aFile,
-      TABLE_FOOTER
-      "</tbody>\n"
-      "</table>\n"
-    );
+    aFile << TABLE_FOOTER
+          << "</tbody>" << std::endl
+          << "</table>" << std::endl;
 
     CloseFile(aFile);
   }
 
   void ReportsHtml::CloseCoverageFile(
-    FILE*  aFile
+    std::ofstream& aFile
   )
   {
-    fprintf(
-      aFile,
-      TABLE_FOOTER
-      "</tbody>\n"
-      "</table>\n"
-      "</pre>\n"
-      "</body>\n"
-      "</html>"
-    );
+    aFile << TABLE_FOOTER
+          << "</tbody>" << std::endl
+          << "</table>" << std::endl
+          << "</pre>"   << std::endl
+          << "</body>"  << std::endl
+          << "</html>";
 
     CloseFile(aFile);
   }
 
   void ReportsHtml::CloseNoRangeFile(
-    FILE*  aFile
+    std::ofstream& aFile
   )
   {
-    fprintf(
-      aFile,
-      TABLE_FOOTER
-      "</tbody>\n"
-      "</table>\n"
-      "</pre>\n"
-      "</body>\n"
-      "</html>"
-    );
+    aFile << TABLE_FOOTER
+          << "</tbody>" << std::endl
+          << "</table>" << std::endl
+          << "</pre>"   << std::endl
+          << "</body>"  << std::endl
+          << "</html>";
 
     CloseFile(aFile);
   }
 
 
   void ReportsHtml::CloseSizeFile(
-    FILE*  aFile
+    std::ofstream& aFile
   )
   {
-    fprintf(
-      aFile,
-      TABLE_FOOTER
-      "</tbody>\n"
-      "</table>\n"
-      "</pre>\n"
-      "</body>\n"
-      "</html>"
-    );
+    aFile << TABLE_FOOTER
+          << "</tbody>" << std::endl
+          << "</table>" << std::endl
+          << "</pre>"   << std::endl
+          << "</body>"  << std::endl
+          << "</html>";
 
-    CloseFile( aFile );
+    CloseFile(aFile);
   }
 
   void ReportsHtml::CloseSymbolSummaryFile(
-    FILE*  aFile
+    std::ofstream& aFile
   )
   {
-    fprintf(
-      aFile,
-      TABLE_FOOTER
-       "</tbody>\n"
-      "</table>\n"
-      "</pre>\n"
-      "</body>\n"
-      "</html>"
-    );
+    aFile << TABLE_FOOTER
+          << "</tbody>" << std::endl
+          << "</table>" << std::endl
+          << "</pre>"   << std::endl
+          << "</body>"  << std::endl
+          << "</html>";
 
      CloseFile( aFile );
   }
diff --git a/tester/covoar/ReportsHtml.h b/tester/covoar/ReportsHtml.h
index 8d209ae..21ca8bd 100644
--- a/tester/covoar/ReportsHtml.h
+++ b/tester/covoar/ReportsHtml.h
@@ -9,6 +9,9 @@
 #ifndef __REPORTSHTML_H__
 #define __REPORTSHTML_H__
 
+#include <string>
+#include <fstream>
+
 #include <stdint.h>
 #include "ReportsBase.h"
 #include "Explanations.h"
@@ -22,7 +25,7 @@ namespace Coverage {
 class ReportsHtml: public ReportsBase {
 
   public:
-    ReportsHtml( time_t timestamp, std::string symbolSetName );
+    ReportsHtml( time_t timestamp, const std::string& symbolSetName );
    ~ReportsHtml();
 
    /*!
@@ -31,8 +34,8 @@ class ReportsHtml: public ReportsBase {
     *  @param[in] fileName identifies the file name.
     */
    void WriteIndex(
-     const char* const fileName
-   );
+     const std::string& fileName
+   ) override;
 
    /*!
     *  This method produces a report that contains information about each
@@ -41,7 +44,7 @@ class ReportsHtml: public ReportsBase {
     *  @param[in] fileName identifies the branch report file name
     */
    void WriteBranchReport(
-     const char* const fileName
+     const std::string& fileName
    );
 
    /*!
@@ -51,7 +54,7 @@ class ReportsHtml: public ReportsBase {
     *  @param[in] fileName identifies the coverage report file name
     */
    void WriteCoverageReport(
-     const char* const fileName
+     const std::string& fileName
    );
 
    /*!
@@ -61,7 +64,7 @@ class ReportsHtml: public ReportsBase {
     *  @param[in] fileName identifies the size report file name
     */
    void WriteSizeReport(
-     const char* const fileName
+     const std::string& fileName
    );
 
   protected:
@@ -75,93 +78,99 @@ class ReportsHtml: public ReportsBase {
     AnnotatedLineState_t lastState_m;
 
     /* Inherit documentation from base class. */
-    virtual FILE* OpenAnnotatedFile(
-      const char* const fileName
+    virtual void  OpenAnnotatedFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /* Inherit documentation from base class. */
-    virtual FILE* OpenBranchFile(
-      const char* const fileName,
-      bool              hasBranches
+    virtual void OpenBranchFile(
+      const std::string& fileName,
+      bool               hasBranches,
+      std::ofstream&     aFile
     );
 
     /* Inherit documentation from base class. */
-    virtual FILE* OpenCoverageFile(
-      const char* const fileName
+    virtual void OpenCoverageFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /* Inherit documentation from base class. */
-    FILE* OpenNoRangeFile(
-      const char* const fileName
+    void OpenNoRangeFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /* Inherit documentation from base class. */
-    virtual FILE* OpenSizeFile(
-      const char* const fileName
+    virtual void OpenSizeFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /* Inherit documentation from base class. */
-    virtual FILE* OpenSymbolSummaryFile(
-      const char* const fileName
+    virtual void OpenSymbolSummaryFile(
+      const std::string& fileName,
+      std::ofstream&     aFile
     );
 
     /* Inherit documentation from base class. */
     virtual void CloseAnnotatedFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
     virtual void CloseBranchFile(
-      FILE*  aFile,
+      std::ofstream& aFile,
       bool   hasBranches
     );
 
     /* Inherit documentation from base class. */
     virtual void CloseCoverageFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
     void CloseNoRangeFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
     virtual void CloseSizeFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
     virtual void CloseSymbolSummaryFile(
-      FILE*  aFile
+      std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
     virtual void PutAnnotatedLine(
-      FILE*                aFile,
+      std::ofstream&       aFile,
       AnnotatedLineState_t state,
-      std::string          line,
+      const std::string&   line,
       uint32_t             id
     );
 
     /* Inherit documentation from base class. */
      virtual void AnnotatedStart(
-      FILE*                aFile
+       std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
      virtual void AnnotatedEnd(
-      FILE*                aFile
+       std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
     virtual bool PutNoBranchInfo(
-      FILE* report
+      std::ofstream& report
     );
 
     /* Inherit documentation from base class. */
     virtual bool PutBranchEntry(
-      FILE*                                            report,
+      std::ofstream&                                   report,
       unsigned int                                     number,
       const std::string&                               symbolName,
       const SymbolInformation&                         symbolInfo,
@@ -170,15 +179,15 @@ class ReportsHtml: public ReportsBase {
 
     /* Inherit documentation from base class. */
     virtual void putCoverageNoRange(
-      FILE*        report,
-      FILE*        noRangeFile,
-      unsigned int number,
-      std::string  symbol
+      std::ofstream&     report,
+      std::ofstream&     noRangeFile,
+      unsigned int       number,
+      const std::string& symbol
     );
 
     /* Inherit documentation from base class. */
     virtual bool PutCoverageLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const SymbolInformation&                        symbolInfo,
@@ -187,7 +196,7 @@ class ReportsHtml: public ReportsBase {
 
     /* Inherit documentation from base class. */
     virtual bool PutSizeLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const CoverageRanges::coverageRange_t&          range
@@ -195,20 +204,21 @@ class ReportsHtml: public ReportsBase {
 
     /* Inherit documentation from base class. */
     virtual bool PutSymbolSummaryLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const SymbolInformation&                        symbolInfo
     );
 
     /* Inherit documentation from base class. */
-    virtual FILE* OpenFile(
-      const char* const fileName
+    virtual void OpenFile(
+      const std::string& fileName,
+      std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
-    virtual bool WriteExplationFile(
-      const char*                  fileName,
+    virtual bool WriteExplanationFile(
+      const std::string&           fileName,
       const Coverage::Explanation* explanation
     );
   };
diff --git a/tester/covoar/ReportsText.cc b/tester/covoar/ReportsText.cc
index 33be32f..35ad786 100644
--- a/tester/covoar/ReportsText.cc
+++ b/tester/covoar/ReportsText.cc
@@ -1,6 +1,8 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <iomanip>
+
 #include "ReportsText.h"
 #include "app_common.h"
 #include "CoverageRanges.h"
@@ -11,7 +13,7 @@
 
 namespace Coverage {
 
-ReportsText::ReportsText( time_t timestamp, std::string symbolSetName ):
+ReportsText::ReportsText( time_t timestamp, const std::string& symbolSetName ):
   ReportsBase( timestamp, symbolSetName )
 {
   reportExtension_m = ".txt";
@@ -22,47 +24,44 @@ ReportsText::~ReportsText()
 }
 
 void ReportsText::AnnotatedStart(
-  FILE*                aFile
+  std::ofstream& aFile
 )
 {
-  fprintf(
-    aFile,
-    "========================================"
-    "=======================================\n"
-  );
+  aFile << "========================================"
+        << "=======================================" << std::endl;
 }
 
 void ReportsText::AnnotatedEnd(
-  FILE*                aFile
+  std::ofstream& aFile
 )
 {
 }
 
 void ReportsText::PutAnnotatedLine(
-  FILE*                aFile,
+  std::ofstream&       aFile,
   AnnotatedLineState_t state,
-  std::string          line,
+  const std::string&   line,
   uint32_t             id
 )
 {
-  fprintf( aFile, "%s\n", line.c_str());
+  aFile << line << std::endl;
 }
 
 bool ReportsText::PutNoBranchInfo(
-  FILE*           report
+  std::ofstream& report
 )
 {
   if ( BranchInfoAvailable &&
     SymbolsToAnalyze->getNumberBranchesFound(symbolSetName_m) != 0 )
-    fprintf( report, "All branch paths taken.\n" );
+    report << "All branch paths taken." << std::endl;
   else
-    fprintf( report, "No branch information found.\n" );
+    report << "No branch information found." << std::endl;
   return true;
 }
 
 
 bool ReportsText::PutBranchEntry(
-  FILE*                                            report,
+  std::ofstream&                                   report,
   unsigned int                                     number,
   const std::string&                               symbolName,
   const SymbolInformation&                         symbolInfo,
@@ -72,90 +71,71 @@ bool ReportsText::PutBranchEntry(
   const Coverage::Explanation* explanation;
 
   // Add an entry to the report
-  fprintf(
-    report,
-    "============================================\n"
-    "Symbol        : %s (0x%x)\n"
-    "Line          : %s (0x%x)\n"
-    "Size in Bytes : %d\n",
-    symbolName.c_str(),
-    symbolInfo.baseAddress,
-    range.lowSourceLine.c_str(),
-    range.lowAddress,
-    range.highAddress - range.lowAddress + 1
-  );
+  report << "============================================" << std::endl
+         << "Symbol        : " << symbolName
+         << std::hex << " (0x" << symbolInfo.baseAddress << ")" << std::endl
+         << "Line          : " << range.lowSourceLine
+         << " (0x" << range.lowAddress << ")" << std::endl
+         << "Size in Bytes : " << range.highAddress - range.lowAddress + 1
+         << std::dec << std::endl;
 
   if (range.reason ==
     Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN)
-    fprintf(
-      report, "Reason        : %s\n\n", "ALWAYS TAKEN"
-    );
+    report << "Reason        : ALWAYS TAKEN"
+           << std::endl << std::endl;
   else if (range.reason ==
     Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN)
-    fprintf( report, "Reason        : %s\n\n", "NEVER TAKEN" );
+      report << "Reason        : NEVER TAKEN"
+             << std::endl << std::endl;
 
   // See if an explanation is available
   explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
 
   if ( !explanation ) {
-    fprintf(
-      report,
-      "Classification: NONE\n"
-      "\n"
-      "Explanation:\n"
-      "No Explanation\n"
-    );
+    report << "Classification: NONE" << std::endl << std::endl
+           << "Explanation:" << std::endl
+           << "No Explanation" << std::endl;
   } else {
-    fprintf(
-      report,
-      "Classification: %s\n"
-      "\n"
-      "Explanation:\n",
-      explanation->classification.c_str()
-    );
-
-    for ( unsigned int i=0 ;
+    report << "Classification: " << explanation->classification
+           << std::endl << std::endl
+           << "Explanation:" << std::endl;
+
+    for ( unsigned int i=0;
           i < explanation->explanation.size();
           i++) {
-      fprintf(
-        report,
-        "%s\n",
-        explanation->explanation[i].c_str()
-      );
+      report << explanation->explanation[i] << std::endl;
     }
   }
 
-  fprintf(
-    report, "============================================\n"
-  );
+  report << "============================================" << std::endl;
 
   return true;
 }
 
 void ReportsText::putCoverageNoRange(
-  FILE*         report,
-  FILE*         noRangeFile,
+  std::ofstream&     report,
+  std::ofstream&     noRangeFile,
   unsigned int  number,
-  std::string   symbol
+  const std::string& symbol
 )
 {
-      fprintf(
-        report,
-        "============================================\n"
-        "Symbol        : %s\n\n"
-        "          *** NEVER REFERENCED ***\n\n"
-        "This symbol was never referenced by an analyzed executable.\n"
-        "Therefore there is no size or disassembly for this symbol.\n"
-        "This could be due to symbol misspelling or lack of a test for\n"
-        "this symbol.\n"
-        "============================================\n",
-        symbol.c_str()
-      );
-      fprintf( noRangeFile, "%s\n", symbol.c_str() );
+  report << "============================================" << std::endl
+         << "Symbol        : " << symbol << std::endl << std::endl
+         << "          *** NEVER REFERENCED ***" << std::endl << std::endl
+         << "This symbol was never referenced by an analyzed executable."
+         << std::endl
+         << "Therefore there is no size or disassembly for this symbol."
+         << std::endl
+         << "This could be due to symbol misspelling or lack of a test for"
+         << std::endl
+         << "this symbol." << std::endl
+         << "============================================" << std::endl;
+
+  noRangeFile << symbol << std::endl;
 }
 
 bool ReportsText::PutCoverageLine(
-  FILE*                                           report,
+  std::ofstream&                                  report,
   unsigned int                                    number,
   const std::string&                              symbolName,
   const SymbolInformation&                        symbolInfo,
@@ -164,73 +144,56 @@ bool ReportsText::PutCoverageLine(
 {
   const Coverage::Explanation*   explanation;
 
-  fprintf(
-    report,
-    "============================================\n"
-    "Index                : %d\n"
-    "Symbol               : %s (0x%x)\n"
-    "Starting Line        : %s (0x%x)\n"
-    "Ending Line          : %s (0x%x)\n"
-    "Size in Bytes        : %d\n"
-    "Size in Instructions : %d\n\n",
-    range.id,
-    symbolName.c_str(),
-    symbolInfo.baseAddress,
-    range.lowSourceLine.c_str(),
-    range.lowAddress,
-    range.highSourceLine.c_str(),
-    range.highAddress,
-    range.highAddress - range.lowAddress + 1,
-    range.instructionCount
-  );
+  report << "============================================" << std::endl
+         << "Index                : " << range.id << std::endl
+         << "Symbol               : " << symbolName
+         << std::hex << " (0x" << symbolInfo.baseAddress << ")" << std::endl
+         << "Starting Line        : " << range.lowSourceLine
+         << " (0x" << range.lowAddress << ")" << std::endl
+         << "Ending Line          : " << range.highSourceLine
+         << " (0x" << range.highAddress << ")" << std::endl
+         << std::dec
+         << "Size in Bytes        : "
+         << range.highAddress - range.lowAddress + 1 << std::endl
+         << "Size in Instructions : " << range.instructionCount
+         << std::endl << std::endl;
 
   explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
 
   if ( !explanation ) {
-    fprintf(
-      report,
-      "Classification: NONE\n"
-      "\n"
-      "Explanation:\n"
-      "No Explanation\n"
-    );
+    report << "Classification: NONE" << std::endl << std::endl
+           << "Explanation:" << std::endl
+           << "No Explanation" << std::endl;
   } else {
-    fprintf(
-      report,
-      "Classification: %s\n"
-      "\n"
-      "Explanation:\n",
-      explanation->classification.c_str()
-    );
+    report << "Classification: " << explanation->classification << std::endl
+           << std::endl
+           << "Explanation:" << std::endl;
 
     for ( unsigned int i=0; i < explanation->explanation.size(); i++) {
-      fprintf( report,"%s\n", explanation->explanation[i].c_str() );
+      report << explanation->explanation[i] << std::endl;
     }
   }
 
-  fprintf(report, "============================================\n");
+  report << "============================================" << std::endl;
   return true;
 }
 
 bool  ReportsText::PutSizeLine(
-  FILE*                                           report,
+  std::ofstream&                                  report,
   unsigned int                                    number,
   const std::string&                              symbolName,
   const CoverageRanges::coverageRange_t&          range
 )
 {
-  fprintf(
-    report,
-    "%d\t%s\t%s\n",
-    range.highAddress - range.lowAddress + 1,
-    symbolName.c_str(),
-    range.lowSourceLine.c_str()
-  );
+  report << range.highAddress - range.lowAddress + 1 << '\t'
+         << symbolName << '\t'
+         << range.lowSourceLine << std::endl;
+
   return true;
 }
 
 bool  ReportsText::PutSymbolSummaryLine(
-  FILE*                                           report,
+  std::ofstream&                                  report,
   unsigned int                                    number,
   const std::string&                              symbolName,
   const SymbolInformation&                        symbolInfo
@@ -240,17 +203,18 @@ bool  ReportsText::PutSymbolSummaryLine(
   float uncoveredInstructions;
 
   if (symbolInfo.stats.sizeInBytes == 0) {
-    fprintf(
-      report,
-      "============================================\n"
-      "Symbol                            : %s\n"
-      "          *** NEVER REFERENCED ***\n\n"
-      "This symbol was never referenced by an analyzed executable.\n"
-      "Therefore there is no size or disassembly for this symbol.\n"
-      "This could be due to symbol misspelling or lack of a test for\n"
-      "this symbol.\n",
-      symbolName.c_str()
-    );
+    report << "============================================" << std::endl
+           << "Symbol                            : " << symbolName << std::endl
+           << "          *** NEVER REFERENCED ***"
+           << std::endl << std::endl
+           << "This symbol was never referenced by an analyzed executable."
+           << std::endl
+           << "Therefore there is no size or disassembly for this symbol."
+           << std::endl
+           << "This could be due to symbol misspelling or lack of a test for"
+           << std::endl
+           << "this symbol." << std::endl
+           << "============================================" << std::endl;
   } else {
     if ( symbolInfo.stats.sizeInInstructions == 0 )
       uncoveredInstructions = 0;
@@ -264,29 +228,30 @@ bool  ReportsText::PutSymbolSummaryLine(
       uncoveredBytes = (symbolInfo.stats.uncoveredBytes*100.0)/
                        symbolInfo.stats.sizeInBytes;
 
-    fprintf(
-      report,
-      "============================================\n"
-      "Symbol                            : %s\n"
-      "Total Size in Bytes               : %d\n"
-      "Total Size in Instructions        : %d\n"
-      "Total number Branches             : %d\n"
-      "Total Always Taken                : %d\n"
-      "Total Never Taken                 : %d\n"
-      "Percentage Uncovered Instructions : %.2f\n"
-      "Percentage Uncovered Bytes        : %.2f\n",
-      symbolName.c_str(),
-      symbolInfo.stats.sizeInBytes,
-      symbolInfo.stats.sizeInInstructions,
-      symbolInfo.stats.branchesNotExecuted +  symbolInfo.stats.branchesExecuted,
-      symbolInfo.stats.branchesAlwaysTaken,
-      symbolInfo.stats.branchesNeverTaken,
-      uncoveredInstructions,
-      uncoveredBytes
-    );
+    report << "============================================" << std::endl
+           << "Symbol                            : "
+           << symbolName << std::endl
+           << "Total Size in Bytes               : "
+           << symbolInfo.stats.sizeInBytes << std::endl
+           << "Total Size in Instructions        : "
+           << symbolInfo.stats.sizeInInstructions << std::endl
+           << "Total number Branches             : "
+           << symbolInfo.stats.branchesNotExecuted +
+              symbolInfo.stats.branchesExecuted
+           << std::endl
+           << "Total Always Taken                : "
+           << symbolInfo.stats.branchesAlwaysTaken << std::endl
+           << "Total Never Taken                 : "
+           << symbolInfo.stats.branchesNeverTaken << std::endl
+           << std::fixed << std::setprecision( 2 )
+           << "Percentage Uncovered Instructions : "
+           << uncoveredInstructions << std::endl
+           << "Percentage Uncovered Bytes        : "
+           << uncoveredBytes << std::endl;
+
+  report << "============================================" << std::endl;
   }
 
-  fprintf(report, "============================================\n");
   return true;
 }
 
diff --git a/tester/covoar/ReportsText.h b/tester/covoar/ReportsText.h
index 23a1003..3e33be9 100644
--- a/tester/covoar/ReportsText.h
+++ b/tester/covoar/ReportsText.h
@@ -21,7 +21,7 @@ namespace Coverage {
 class ReportsText: public ReportsBase {
 
   public:
-    ReportsText( time_t timestamp, std::string symbolSetName );
+    ReportsText( time_t timestamp, const std::string& symbolSetName );
     virtual ~ReportsText();
 
   /*!
@@ -31,7 +31,7 @@ class ReportsText: public ReportsBase {
    *  @param[in] fileName identifies the branch report file name
    */
   void WriteBranchReport(
-    const char* const fileName
+    const std::string& fileName
   );
 
   /*!
@@ -41,7 +41,7 @@ class ReportsText: public ReportsBase {
    *  @param[in] fileName identifies the coverage report file name
    */
   void WriteCoverageReport(
-    const char* const fileName
+    const std::string& fileName
   );
 
   /*!
@@ -51,37 +51,37 @@ class ReportsText: public ReportsBase {
    *  @param[in] fileName identifies the size report file name
    */
   void WriteSizeReport(
-    const char* const fileName
+    const std::string& fileName
   );
 
   protected:
 
    /* Inherit documentation from base class. */
     virtual void PutAnnotatedLine(
-      FILE*                aFile,
+      std::ofstream&       aFile,
       AnnotatedLineState_t state,
-      std::string          line,
+      const std::string&   line,
       uint32_t             id
     );
 
    /* Inherit documentation from base class. */
      virtual void AnnotatedStart(
-      FILE*                aFile
+       std::ofstream& aFile
     );
 
     /* Inherit documentation from base class. */
      virtual void AnnotatedEnd(
-      FILE*                aFile
+       std::ofstream& aFile
     );
 
    /* Inherit documentation from base class. */
     virtual bool PutNoBranchInfo(
-      FILE* report
+      std::ofstream& report
     );
 
    /* Inherit documentation from base class. */
     virtual bool PutBranchEntry(
-      FILE*                                            report,
+      std::ofstream&                                   report,
       unsigned int                                     number,
       const std::string&                               symbolName,
       const SymbolInformation&                         symbolInfo,
@@ -90,15 +90,15 @@ class ReportsText: public ReportsBase {
 
    /* Inherit documentation from base class. */
     virtual void putCoverageNoRange(
-      FILE*        report,
-      FILE*        noRangeFile,
-      unsigned int number,
-      std::string  symbol
+      std::ofstream&     report,
+      std::ofstream&     noRangeFile,
+      unsigned int       number,
+      const std::string& symbol
     );
 
    /* Inherit documentation from base class. */
     virtual bool PutCoverageLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const SymbolInformation&                        symbolInfo,
@@ -107,7 +107,7 @@ class ReportsText: public ReportsBase {
 
    /* Inherit documentation from base class. */
     virtual bool PutSizeLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const CoverageRanges::coverageRange_t&          range
@@ -115,7 +115,7 @@ class ReportsText: public ReportsBase {
 
    /* Inherit documentation from base class. */
     virtual bool PutSymbolSummaryLine(
-      FILE*                                           report,
+      std::ofstream&                                  report,
       unsigned int                                    number,
       const std::string&                              symbolName,
       const SymbolInformation&                        symbolInfo
-- 
1.8.3.1



More information about the devel mailing list