X-Spam-Check-By: sourceware.org Date: Fri, 29 Dec 2006 21:40:45 -0500 (EST) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: =?ISO-8859-1?Q?Ciar=E1n_=D3_Duibh=EDn?= cc: cygwin AT cygwin DOT com Subject: Re: Calling a cygwin binary from CreateProcess - problem with redirection In-Reply-To: <000b01c72ba8$f99d8aa0$78d94c51@default> Message-ID: References: <000b01c72ba8$f99d8aa0$78d94c51 AT default> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1524768324-1167446445=:27982" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com ---559023410-1524768324-1167446445=:27982 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Sat, 30 Dec 2006, Ciarán Ó Duibhín wrote: > Hi, > > I have no experience with cygwin, but I downloaded a Windows .exe which > is a unix program compiled for Windows with cygwin. Several cygwin > dll's are included. > > I can run this program from the DOS command line. > An example command line is: > c:\progra~1\freeli~1.4\analyzer -f data\config\en.cfg < c:\split.txt > > new.txt > > But I would like to launch it from another Windows application - a > graphic interface I am writing for it, in fact. However, when I supply > the above command line to the Windows CreateProcess function as the > lpCommandLine parameter, I get the error message > "CONFIG_OPTIONS: Error -11 parsing command line. > unknown option '' at position 4 in command line" > ie. the redirection symbol <. It doesn't matter whether or not there is > a space after the redirection symbol. > > This is the same error message as produced when a commandline parameter > which is genuinely in error is supplied to the program, so it seems that > the combination of CreateProcess and cygwin is passing the redirection > parameter to the program in some mutated form, whereas it arrives > correctly from the command line. Ciarán, CreateProcess() is not a shell -- it will pass all arguments (including your redirection specifiers) to the program. This is not a Cygwin-specific problem -- you would have gotten the same errors with a pure Windows executable. You might want to read up on the arguments to CreateProcess on MSDN (especially the input/output handles in the STARTUPINFO structure). If you have further questions, a Windows-specific list might be a better venue. HTH, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Freedom is just another word for "nothing left to lose"... -- Janis Joplin ---559023410-1524768324-1167446445=:27982 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ---559023410-1524768324-1167446445=:27982--