>>I used to do way more programming in C/C++, and for a real eye opener one time, we ran lint (a C utility) on our code. It found over 300 questionable pointer references in this one large program we had. The program never crashed, but after examining each of these places in the code, we could see where there was a potential for problem. I wish there was something like that utility for VFP! Like I said, you've just been lucky! (Tick, tick, tick...) :)
>
>Okay, here's my new one-line version of obtaining user name:
>
>ALLTRIM(SUBSTR(SYS(0),ATC('#',SYS(0))+1,LEN(SYS(0))))
>
>I *think* this will always work in a network environment, though you might want to check for a '0' result (I think it is) to ensure there's been a login.
Hi Bruce,
I'd first assign SYS(0) to a variable. This would eliminate three function calls in the above. Further, I'd simplify it to:
lcuser = SYS(0)
lcuser = ALLTRIM(SUBSTR(lcuser, ATC('#', lcuser) + 1))
There's no need to provide a length for SUBSTR() since it will take whatever remains of the string if it isn't provided.
George
Ubi caritas et amor, deus ibi est