public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* can't manage to use "windows" command-line (C development)
@ 2002-12-14 21:22 Atreides
  2002-12-14 21:40 ` Christopher Faylor
  0 siblings, 1 reply; 3+ messages in thread
From: Atreides @ 2002-12-14 21:22 UTC (permalink / raw)
  To: cygwin

Hi,

While trying to do some C programs under cygwin, in order to launch usual
Win32 programs, I faced problem to launch them with arguments :

I explain : I want to launch "Pilot Install" from envicon.com with a text
file (full path included) for parameter. I tried to launch it using a cygwin
shell, does not work... (argument is not understood by the program). From a
DOS Box (with properly arranged paths of course) : same thing ...
But when I enter the same command-line, as in the DOS Box, in the
Start/Execute Panel in the start menu : It works!!!

So my question is : is it possible in a C program under cygwin (I use gcc),
to launch such command lines? (like the "system()" instruction, but for
windows).

thanks in advance

Nicolas DUTEIL


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: can't manage to use "windows" command-line (C development)
  2002-12-14 21:22 can't manage to use "windows" command-line (C development) Atreides
@ 2002-12-14 21:40 ` Christopher Faylor
  2002-12-15  4:37   ` Atreides
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Faylor @ 2002-12-14 21:40 UTC (permalink / raw)
  To: cygwin; +Cc: atreidpub

On Sun, Dec 15, 2002 at 03:24:29AM +0100, Atreides wrote:
>Hi,
>
>While trying to do some C programs under cygwin, in order to launch usual
>Win32 programs, I faced problem to launch them with arguments :
>
>I explain : I want to launch "Pilot Install" from envicon.com with a text
>file (full path included) for parameter. I tried to launch it using a cygwin
>shell, does not work... (argument is not understood by the program). From a
>DOS Box (with properly arranged paths of course) : same thing ...
>But when I enter the same command-line, as in the DOS Box, in the
>Start/Execute Panel in the start menu : It works!!!
>
>So my question is : is it possible in a C program under cygwin (I use gcc),
>to launch such command lines? (like the "system()" instruction, but for
>windows).

Yes, it's possible.  Try running "net use", for example.  Most Windows
command-line tools work fine from a cygwin shell.

You're not providing enough details to debug the problem, unfortunately.

You have to think about this from the point of view of someone who has
no idea what "Pilot Install" is, what its command line parameters are,
or what you could conceivably be typing on the command line that would
be causing a problem.  It could be as simple as your not properly quoting
command line arguments which use '\' characters.  There's no way to tell,
however, because you aren't providing details.

See http://cygwin.com/bugs.html for more details on how to provide details.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: can't manage to use "windows" command-line (C development)
  2002-12-14 21:40 ` Christopher Faylor
@ 2002-12-15  4:37   ` Atreides
  0 siblings, 0 replies; 3+ messages in thread
From: Atreides @ 2002-12-15  4:37 UTC (permalink / raw)
  To: cygwin

> >I explain : I want to launch "Pilot Install" from envicon.com with a text
> >file (full path included) for parameter. I tried to launch it
> using a cygwin
> >shell, does not work... (argument is not understood by the
> program). From a
> >DOS Box (with properly arranged paths of course) : same thing ...
> >But when I enter the same command-line, as in the DOS Box, in the
> >Start/Execute Panel in the start menu : It works!!!
> >
> >So my question is : is it possible in a C program under cygwin
> (I use gcc),
> >to launch such command lines? (like the "system()" instruction, but for
> >windows).
>
> Yes, it's possible.  Try running "net use", for example.  Most Windows
> command-line tools work fine from a cygwin shell.
> You're not providing enough details to debug the problem, unfortunately.

Hello, you were right, I didn't give enough details (it was 3:00 am for me
:)).
Anyway I resolved my problem :
I wanted to launch something like "C:\Program
Files\Pilot_Install_4.0\Pinstall.exe C:\WINNT\Temp\temp_0123456.txt".
So I tried to translate the path of the exe in cygwin paths, or the path of
the argument, or both, but nothing seemed to work. Finally I understood!!!
The program needs a DOS path, even if it is launched through cygwin. And ,
Here is the tricky thing, the argument is parsed by cygwin, so :
"/cygdrive/c/Program\ Files/Pilot_Install_4.0
c:\WINNT\Temp\temp_0123456.txt" does not work
But "/cygdrive/c/Program\ Files/Pilot_Install_4.0
c:\\WINNT\\Temp\\temp_0123456.txt" WORKS!!
The "\\" are interpreted by Cygwin as "\" and are needed for Cygwin to pass
an "understandable" path to windows.

And trickier, I use several strings in my program to build this command
line, and so, there is a second interpretation of the string. So the string
I must use to build this command line is :
"c:\\\\WINNT\\\\Temp\\\\temp_0123456.txt"

Anyway thanks for help.

Nicolas DUTEIL


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-15 11:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-14 21:22 can't manage to use "windows" command-line (C development) Atreides
2002-12-14 21:40 ` Christopher Faylor
2002-12-15  4:37   ` Atreides

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).