[Cialug] Re: OT: Interesting "feature" in Windows

Tim Wilson tim_linux at wilson-home.com
Tue Sep 25 16:50:32 CDT 2007


Sorry, I hit the wrong key, and it got sent.  I'll finish my e-mail below.

On 9/25/07, Tim Wilson <tim_linux at wilson-home.com> wrote:
>
> I ran across a problem today, that I thought some of you might enjoy.  A
> customer was running a product we talk to in a directory like "C:\Program
> Files\Foo Bar\Foo2".  In this directory, my app runs a batch file.  The
> easiest way to execute the batch file from a C program is to call system(),
> right?  That's great, except it has a problem with spaces.  No problem, I'll
> put escaped double quotes around the argument to system().  That too, did
> not work.  After doing some Googling, I found something that sounds like
> others are experiencing the same problem (someone created a bug at codehaus
> for jruby).


Talking around the office, Chris F suggested (as a joke), to specify it as
an environment variable.  Guess what?  It worked.  So if I want to continue
to allow customers to put the other product in a path with spaces in it,
I'll have to do a putenv() first, and then reference the environment
variable in the system() call.  Nice work Microsoft!

-- 
> Tim




-- 
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cialug.org/pipermail/cialug/attachments/20070925/d6bd9a99/attachment.htm


More information about the Cialug mailing list