Information générale
Titre:
Returning user name from operating system
Hello:
I'm using the following code in a method to return the user name from an o/s.
The users full streettalk addresses are in the users file and when
I test on my hard drive code works fine but when I put executable up on the network (Bayon) ,it works sporadically. Sometimes it works,
other times it picks up the last user that logged in. Could it be
that it's not closing the fhandle? Anybody have a similar problem
that could offer some input?
Any help would be appreciated.
THanks.
hld = ""
hld1 = ""
If file("Z:\WHOAMI.EXE")
cmd_str = "Z:\WHOAMI > "+CTEMPPATH+"WHOAMI.TXT"
Do DosRun with cmd_str
fhandle = fopen(CTEMPPATH+"WHOAMI.TXT",0)
tmp = fread(fhandle,60)
tmp = substr(tmp,5,len(tmp))
=fclose(fhandle)
If not empty(tmp)
hld1 = ATC("@", tmp)
If hld1 = 0
street_talk = ""
Else
nPos = hld1-1
street_talk = Left(tmp,nPos)
return street_talk
Endif
Endif
Else
hld = ""
street_talk = ""
return hld
Endif
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement