I try to understand the file reading in c++ and try to read a file that doesn't exist deliberately
//includes ommited int main(int argc, char ** argv) { if(argc != 1) throw std::exception(); std::ifstream file(argv[0]); std::string content((std::istream_iterator<char>(file)), std::istream_iterator<char>()); std::cout << content.c_str() << std::endl; } It prints the following:
ELF Why is it supposed to mean? Do I just get UB by doing this? Since I'm a Java coder I expected that some exception will be thrown if we try to read a file that doesn't exist...