I have been using the scan functions for reading in some fairly primitive
options data from text files and i have run into the following bug:
when reading unsigned integers separated by typical charactes (such as "/"
or "-") for dates, for some reason scan chokes on reading "09" into a the
integer number 9. Here's a simple example that will illustrate:
--------------------------
#include <oxstd.h>
main(){
decl test,n1,n2,n3;
test="01/02/03";
sscan(test,"%2u",&n1,"/%2u",&n2,"/%2u",&n3);
print(n1~n2~n3);
test="01/09/03";
sscan(test,"%2u",&n1,"/%2u",&n2,"/%2u",&n3);
print(n1~n2~n3);
}
-------------------------
The first test works fine but the second fails to read the number 9 in the
middle. I have done some fairly extensive tensing and this error happens
only with numbers that start with "09" and the separator makes no
difference. The error happens when using "/", "-", " " (space) and several
others.
I hope there is an easy workaround for this... I have to read in literally
hundreds of thousands of little files that contain dates in this format...
thanks,
daniel
-----------------------------------------------------
Daniel Morillo
[log in to unmask]
http://www.econ.uiuc.edu/~morillo/personal/
http://www.econ.uiuc.edu/~morillo/links.html
University of Illinois at Urbana-Champaign
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|