I reached another part of my program where I have the following statement which prints out these values on screen.

printf(" %d %d %d %d %d %d %d(%.1foC) %d %d(%s) %d(%.2f) %d(%s) %d\n",
year, month, day, hour, minutes, evtStart, temperature, tempDegC, checksum, basicSelfTest, bstResult, batteryVolt, (float)(batteryVolt*0.0198), powerUpCode, statusCode, timeElapsed);


I was wondering what would be the best way to show these values in notepad?

Thank you in advance!

You can save them to a file, and open the file with notepad.

Hi William,

I was trying to do that, but I cant seem to store the values as a string to make a "*.txt" file due to the integer values.

could you maybe show me a brief example of how I could go about this?

Thank you for your reply

Open a file stream, here's a small example:

#include <iostream>
#include <fstream>

int main() {
  std::ofstream out("myfile.txt", std::ios::out);
  out << "File content here";
  out.close();
  system("notepad.exe myfile.txt");
}

Thank you William Hemsworth,

you code sniplet is very helpful, although when shown in notepad is simply shows

"%d %d %d %d %d %d %d(%.1foC) %d %d(%s) %d(%.2f) %d(%s) %d\n" instead fo formatting the output to this.

do you know a way in which I could overcome this?

Thank you for your help!

Thank you William Hemsworth,

you code sniplet is very helpful, although when shown in notepad is simply shows

"%d %d %d %d %d %d %d(%.1foC) %d %d(%s) %d(%.2f) %d(%s) %d\n" instead fo formatting the output to this.

do you know a way in which I could overcome this?

Thank you for your help!

That's the format of the string, if you want to use that, research sprintf.

This article has been dead for over six months. Start a new discussion instead.