PDA

View Full Version : Read files with strings and doubles



thebra
18th January 2007, 20:38
Hi everyone,
I want to open ASCII files in qt3 and display and do some computation with the numbers, but it happens that some files contain some text and I could not find a way to avoid reading these characters. How can I ask my code to read doubles only, as it always crashes once the characters are passed to my functions.
Thanks for any help

wysota
18th January 2007, 20:41
I'd read a token one at a time using QTextStream and check if each token read is a real number. If it's not, simply ignore it and read on.