Win32API question - PathAppend (in/out variable issue)

That works great, thanks.

I did replace "Array.new.fill(0.chr,0..MAX_PATH-1).join" with just
"0.chr * MAX_PATH", though.

Regards,

Dan

···

-----Original Message-----
From: Paul Leonard [mailto:pleonard23@beadmix.com]
Sent: Friday, May 20, 2005 5:20 PM
To: ruby-talk ML; djberg96@hotmail.com
Subject: Re: Win32API question - PathAppend (in/out variable issue)

Daniel -

This works:

require "Win32API"

MAX_PATH = 256

inbuf = Array.new.fill(0.chr,0..MAX_PATH-1).join

PathAppend = Win32API.new("shlwapi","PathAppend","PP","L")

path = 'C:\foo'

inbuf[0..path.length-1] = path

PathAppend.call(inbuf, 'bar'+ 0.chr)

puts inbuf.strip!

Returns:
C:\foo\bar