Do not learn from rdstate() , badbit or failbit , but specifically what happened. Or, besides reading status flags, nothing is known about the threads?
|
1 answer
Built-in basic tools that describe in detail the cause of the error - no.
What happened specifically depends on the function you are calling for the thread. But even here everything is not so simple, for example, open can return an error both in the absence of a file and in the absence of access to the file for reading, say. To learn more, you need to do a more comprehensive error analysis by means of system (and therefore platform-dependent) calls.
When working with files, the situation may change to include the filesystem library in the C ++ Standard.
- “more comprehensive error analysis” —can an example? For simplicity, you can limit Unix, where the open system call can expose a couple dozen different errno values. I think the author's question can be interpreted as: does the portable c ++ API provide a higher level access to these details? - jfs
- The @jfs in question is about
std::*stream, and the member functionopenfrom there, not the systemopen. - αλεχολυτ - I know. Why do you think I mentioned: "Does a higher level portable c ++ API provide access to these details." - jfs
- @jfs judging by the comments on the question of the vehicle, you just need to read numbers of different types. A portable API will appear when the
filesystemis included in the Standard. - αλεχολυτ - onethe question (see the title) is whether useful details about the error, such as those provided by the system open, can be extracted from the already existing API (iostream — see the contents of the question). - jfs
|
cindoubleandint, and there actually isintanddouble. After readingdouble, you look fine, now you are readingint. He reads the whole part of thedoublewritten in reality, and also reports that everything is in order. Finally, you read anotherint, and it sees the decimal separator and throws an error. Do you see how far the cause is from the effect? - VladDdouble, but readint, where does the standard library recognize this from? Or thereintshould have been read, but you have some Tamil locale, and in it1not considered a digit. Well, it will tell you that it can not find the numbers in the string, how will this help? The system does not know if the source of the error is the wrong locale or the wrong type of read value, for example. - VladD