I have built this code to output a binary file containing a look up table for a multiplexed 7 segment display.
I am pretty new to coding but am learning. I think I am pretty close, but I am not sure what I am missing to make this code run properly.
I get this error for each loop:
error: no match for call to '(std::ofstream {aka std::basic_ofstream<char>}) (uint32_t, int8_t&)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
uint32_t value = 0;
int main()
{
//Program data bytes
cout << "Writing Binary File2";
int8_t digits[] = {0X3f, 0X06, 0X5b, 0X4f, 0X66, 0X6d, 0X7d, 0X07, 0X7f, 0X6f, 0X77, 0X7c, 0X39, 0X5e, 0X79, 0X71 }; // 7-segment display output bytes for hexidecimal
std::ofstream fout1("HexDisplay.bin", fout1.binary|fout1.out);
if (!fout1) {
std::cerr << "Error opening output files.\n";
return 1;
}
for (value = 0; value <= 65535; value +=1){
fout1(value + 0, digits[(value / 1) % 16]);
}
cout <<("OnesDone!..."); //
for (value = 0; value <= 65535; value +=1){
fout1(value + 65536, digits[(value / 16) % 16]);
}
cout <<("TensDone!...");
for (value = 0; value <= 65535; value +=1){
fout1(value + 131072, digits[(value / 256) % 16]);
}
cout <<("HundredsDone!...");
for (value = 0; value <= 65535; value +=1){
fout1(value + 196608, digits[(value / 4096) % 16]);
}
cout <<("ThousandsDone!...");
fout1.write((char*)&fout1, 1);
cout << "Programming Complete!...";
}