Probably doing something stupid, if anyone can point me in the right direction it'd be appreciated. Not getting any output at all besides the logs that the binary file is loaded and the "press any key" prompt. Variables logged in my IDE (see screenshot) are logged at the std::cout << hexContent with a breakpoint added there.
#include "filesystem"
#include <fstream>
#include <vector>
#include <string>
#include <cassert>
#include <bitset>
int main()
{
namespace fs = std::filesystem;
fs::path f{"rom/rom.h"};
std::ifstream::pos_type size;
std::vector<uint8_t> memblock(size);
//check if file exists
if (fs::exists(f))
{
std::cout << "File exists" << std::endl;
// Open Binary file
std::ifstream input(f, std::ios::in | std::ios::ate | std::ios::binary);
if (input.is_open())
{
size = input.tellg();
input.seekg(0, std::ios::beg);
input.read(reinterpret_cast<char*>(memblock.data()), size);
input.close();
std::cout << "The complete file is in memory" << std::endl;
std::stringstream ss;
for (int i = 0; i < size; ++i)
{
ss << std::hex << (int)memblock[i];
}
std::string hexContent = ss.str();
std::cout << hexContent;
}
}
else
{
std::cout << "File does not exist" << std::endl;
}
//prevents application from automatically closing and waiting for user-input. Debugging purposes.
std::cout << "Press any key to exit." << std::endl;
std::cin.ignore();
std::cin.get();
return 0;
}```
