[Qt-interest] a question on QTextStream

Yifei Li yifli at mtu.edu
Fri Apr 10 17:00:51 CEST 2009


Hi all,

Suppose I use QTextStream to read floating point numbers from a text 
file like this:

QTextStream stream;     float f;
stream >> f;


I'm wondering how to detect failures in this process (i.e.,  
'1afg23.99'  is  encountered).
The document says in this case f will be set to 0.0.   But what if the 
numer I try to read happens to be 0.0?

Can anyone help me out?

Thanks

Yifei



More information about the Qt-interest-old mailing list