From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CNiString >> operator

Is there any error checking in this operator? Do I use a try / catch / throw?

Thanks,
Lyle
0 Kudos
Message 1 of 4
(3,177 Views)
The operator just converts a value to a string and appends the string representation to the end of the string. It only supports a subset of data types, namely characters, integers, shorts, longs, floats, doubles, and strings. None of these data types should cause errors. What kind of errors are you seeing or anticipating?

- Elton
0 Kudos
Message 2 of 4
(3,177 Views)
The string is being loaded from a file, then I am converting the string to doubles. I just want to put in some kind of error checking in case the file contains some junk. "1.23 2.47 3garbage.34 5.25" e.g.

Lyle
0 Kudos
Message 3 of 4
(3,177 Views)
Sorry, I should have read your question more carefully. I was talking about operator<<, but you were asking about operator>>. CNiString::operator>> does not throw exceptions if the data's in the wrong format.

- Elton
0 Kudos
Message 4 of 4
(3,177 Views)