I need to specify a MAC-Address from an ip-Address. I intend to manage this with a ping on the ip followed by an arp request.
When i test following code | aString | aString := 'dir c:\'. Transcript show: (ExternalProcess new shOne: aString). i can execute the command in the Windows-Shell and get the directory tree of my HD. When i try this one, to solve my problem | aString | aString := 'ping 10.26.64.1'. Transcript show: (ExternalProcess new shOne: aString). the code causes following exception 'Unhandled exception: Strings only store Characters' I debugged the code and have no idea how to solve this problem. Maybe anyone can help me. Cheers, Harald |
At 04:55 AM 7/6/2010, HaJo wrote:
>I need to specify a MAC-Address from an ip-Address. I intend to manage this >with a ping on the ip followed by an arp request. > >When i test following code > > | aString | > aString := 'dir c:\'. > Transcript show: (ExternalProcess new shOne: aString). > >i can execute the command in the Windows-Shell and get the directory tree of >my HD. > >When i try this one, to solve my problem > > | aString | > aString := 'ping 10.26.64.1'. > Transcript show: (ExternalProcess new shOne: aString). > >the code causes following exception > > 'Unhandled exception: Strings only store Characters' Try this | aString | aString := 'ping 10.26.64.1'. (ExternalProcess new shOne: aString) inspect to see what you're getting back from the ping. -cstb _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
If you fork an external process, you need to know what
encoding the result is going to come back as. If you use shOne:, you're
getting a Windows shell, and we tell the Windows shell what encoding to
use for shell commands - UTF-16, using the /u command-line option. That
means you'll get back correct answers for things like directory listings
with files that have interesting characters in their name. But if the
program in question doesn't honour that, it'll give things back in some
other encoding, probably something like CP437. So something more
like
WinProcess new fork: 'ping' arguments: #('10.26.64.1') would do it. You're getting the wrong encoding in that case, but since your result is likely ascii, it's not wrong enough to make a difference. Throwing in an "encoding: '437'; " will set it to one that is more likely to be right. At 06:33 PM 2010-07-08, cstb wrote: At 04:55 AM 7/6/2010, HaJo wrote: --
Alan Knight [|], Engineering Manager, Cincom Smalltalk
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |