[Qt-interest] a question on QTextStream

Girish Ramakrishnan girish at forwardbias.in
Fri Apr 10 20:54:44 CEST 2009


Yifei Li wrote:
> 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?
> 

http://doc.trolltech.com/4.4/qtextstream.html#status

Girish



More information about the Qt-interest-old mailing list