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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.