Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CHRTRAN() causes C5
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00215436
Message ID:
00215508
Views:
31
>>>>I have recently traced a seemingly random occurence of the C5 error to a line of code containing the CHRTRAN() function. Searching the MS KB turned up an article that conforms this to be a bug in VFP 5x, especially on NT machines (I am using NT4, SP4). But the article states that the bug has been corrected in VFP6. Apparently not. Has anyone else gotten this in VFP6?
>>>
>>>Erik,
>>>
>>>What's the line of code? I can test on Win98, but not NT for you.
>>
>>Well, I can give you the code, but since the error is random, I can't guarantee you'll be able to reproduce the it...
>>
>>IF !EMPTY(CHRTRAN(tcDate, "0123456789", ""))
>> RETURN {}
>>ENDIF
>>
>>Where tcDate is a string in the format that DTOS() returns. Ex: "19990505"
>>The line is checking to make sure that no characters other than digits made it into the string. I know I can work around the CHRTRAN line by looping through each character and checking ISDIGIT(), but I just wanted to know if MS knew this was happening to me.
>>
>>This code runs in a fairly tight loop, so I estimate it crashes 1 in 250 iterations.
>>
>>Check out MS KB Article Q182249 for details. Thanks for the offer.
>
>I'll run some tests under Win98 (since Paul is working under Win95). I'll have to work up a random date generator, however. What date ranges are you working in?

All the dates I am working in are from 1999 to 2030 (bond maturity dates). But, I think if the error was going to occur on your machine, it would probably occur with any numeric string, regardless of content or length.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform