While following along the vulkan-tutorial I've encountered a problem. I am simply unable to open files using the method he uses.
I have a file called shader.frag.spv, which is fragment shader compiled to spir-v code. It is in my source folder, where my readFile is as well.
Here is the code that reproduces my problem:
#include <iostream> #include <fstream> void readFile(const std::string& filename) { std::ifstream file(filename, std::ios::ate | std::ios::binary); if (file.is_open()) std::cout << "test"; else { std::cin.get(); // I always land on the else block } } int main() { readFile("shader.frag.spv"); } Restarting visual studio, changing the name of the file, altering its content, moving it to separate folder, using an absolute path. None of this has solved my issue.
Any ideas?
std::ios::ate? It makes no sense for an input-only stream.