Dart Home | PowerTCP Emulation for ActiveX | Custom Development | Reply | PowerTCP Emulation / Telnet for ActiveX Topics | Forums |
Author | Forum: PowerTCP Emulation / Telnet for ActiveX Topic: TelnetTool and Current Directory with VB6 |
kbeaudry From: Winnipeg, MB USA Posts: 5 Member Since: 10/31/03 |
posted October 31, 2003 10:45 AM Can someone tell me if there is a way to retrieve the current remote directory of a telnet session. For example, If I telnet to a UNIX box, and change to another directory, how can I tell my application what directory I am currently in? Thanks for any help |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted October 31, 2003 11:42 AM You would issue a 'pwd' command and then parse the directory name out of the result. Something like this would work: Private Function GetRemoteDir(tnt As Telnet) ' Send pwd command Dim cmd As String cmd = "pwd" + vbCrLf tnt.Send cmd ' Dim a string to be used by the search method Dim Data As String Data = "" ' Search for end of line (this will be the command ' being echoed back ) Data = "" tnt.Search Data, vbCrLf ' Search for end of next line (this will be the directory name) Data = "" tnt.Search Data, vbCrLf ' Return result after stripping off crlf GetRemoteDir = Left(Data, Len(Data) - 2) End Function |
kbeaudry From: Winnipeg, MB USA Posts: 5 Member Since: 10/31/03 |
posted October 31, 2003 12:05 PM Thanks for the prompt reply. I really appreciate it |
Reply | PowerTCP Emulation / Telnet for ActiveX Topics | Forums |
This site is powered by
![]() |