Could somebody please tell me how do I write a file in "try catch" block for checking if the file exists, if it is opened, if it is not empty. This is the error message I get when the file not exist or it is empty.

terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr

Recommended Answers

All 2 Replies

You can refer to this.

thanks :)

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.