Hi,

try with this:

FFITutorial>>getHostNameInto: hostName ofLenght: length
^self ffiCall: #( int gethostname(char *hostName, int length) ) library: 'Ws2_32.dll'. "... on Windows"

From Playground, you can then do:

| name len |
len := 50.
name:= ByteArray new: len.
FFITutorial new getHostNameInto: name ofLenght: len.
name inspect.

I hope this helps.

Best wishes,
Tomaz

Reply via email to