Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #266

Re: Splitting a string containg filename+path and arguemnts

From Deanna Earley <dee.earley@icode.co.uk>
Newsgroups microsoft.public.vb.general.discussion, comp.lang.basic.visual.misc
Subject Re: Splitting a string containg filename+path and arguemnts
Date 2011-06-15 15:21 +0100
Organization Aioe.org NNTP Server
Message-ID <itaf5b$ohb$1@speranza.aioe.org> (permalink)
References <itaab6$n61$1@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


On 15/06/2011 13:59, Leo wrote:
> I am writing a Shell() replacement that I intend to be a drop in
> replacement. I am using ShellExecuteEx so I can parse a n image or text
> file in. The problem comes with spliting the arguements from the
> path+filename, what is the best way to split them assuming possible
> paths with spaces that aren't quoted. An example that works with Shell()
> and WinExec (I know I shouldn't be using it) but I strugle with spliting
> is C:\Program Files\Windows NT\Accessories\wordpad.exe
> C:\Users\username\Documents\somertf.rtf . PathRemoveArgs gets confused
> and cuts the path at the space in "Program Files".

The "official" way is to split on the first unquoted space.
You can try to be more intelligent by splitting on eahc in turn until 
you get a match for a valid file.
Alterntaively, just pass the whole lot to ShellExecute as lpFile and let 
it handle it. It's a lot more forgiving...

-- 
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Splitting a string containg filename+path and arguemnts Leo <ttdhead@gmail.com> - 2011-06-15 22:59 +1000
  Re: Splitting a string containg filename+path and arguemnts Deanna Earley <dee.earley@icode.co.uk> - 2011-06-15 15:21 +0100
  Re: Splitting a string containg filename+path and arguemnts Karl E. Peterson <karl@exmvps.org> - 2011-06-15 11:14 -0700

csiph-web