02:File I/O HourlyLog.cpp Class, Using the attached program, complete the TODO tasks in the HourlyLog.cpp program above. It is recommended to do the steps in the given numbered order. I.E. Step 1...,...



02:File I/O



HourlyLog.cpp



Class,



Using the attached program, complete the TODO tasks in the HourlyLog.cpp program above.


It is recommended to do the steps in the given numbered order. I.E. Step 1..., Step2 ,,, etc.


The data file should only be closed at the end of the program. It should not be re-opened during the processing.


The data isnotexpected to be in a sorted order when displayed.


Update: Your compiler may need the statement#include
to compile for VS.











BELOW ARE THE CODE INSIDE HourlyLog.cpp program


// MS Visual Studio 2015 uses "stdafx.h" - 2017 uses "pch.h" //#include "stdafx.h" //#include "pch.h"  #include  #include  #include   using namespace std;  struct hourlyLog { int hourKey; // 0 - 23 int validAccessCount = 0; int invalidAccessCount = 0; int errorCount = 0; };   const string HOURLY_FILE_NAME = "SystemHourly.log";   /* The testLoad method is given as an example of passing a fstream and writing data It does not need to be called and can be removed or commented out or left as-is. The data itself is not important for this demo method */   void testLoad(fstream &myStream) {  hourlyLog aLog;      myStream.seekg(0L,ios::beg); // set file to beginning      for (int x = 0; x (&aLog),sizeof(aLog)); // write data }  }   // Your work here   int main() {  hourlyLog myData; fstream dataFile;  // UPDATE V1 START   dataFile.open(HOURLY_FILE_NAME, ios::in | ios::out | ios::ate | ios::binary); if (dataFile.fail()) { // must not exist - try this mode dataFile.open(HOURLY_FILE_NAME, ios::out); // build the file. if (dataFile.fail()) {     cout






Jun 13, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here