delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/15/12:13:30

X-Spam-Check-By: sourceware.org
Message-ID: <44411B9B.BC626D54@dessent.net>
Date: Sat, 15 Apr 2006 09:13:15 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Not sure what the problem is...
References: <20060415160045 DOT 32766 DOT qmail AT web38112 DOT mail DOT mud DOT yahoo DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

The One wrote:

> I have this C program running on windows xp and it's
> calling system("ls -la c:\mydir >
> c:\mydir\tmp\lookup.txt") to list "mydir" and pipe the
> result to a file "lookup.txt" the subdirectory "tmp".

Well for one thing, in C if you want a backslash in a string constant
you need to use "\\".  "\t" is the tab character, "\n" is a newline, and
so on.  Consult a book on C for more information, this is offtopic for
the list.

But if you're using Cygwin you should not be passing around win32 paths
like that.  Cygwin tools expect Posix paths, and that they happen to
work with win32 paths is just coincidental and may break at any time. 
In fact there are many Cygwin utilities that will not work properly if
you do this, you can see the results of these mistakes scattered
throughout the list archives.

You should use "c:/mydir", or preferably, "/cygdrive/c/mydir".  Or, if
you've changed your cygdrive prefix to "/" you could just use
"/c/mydir".  See also "man cygpath".

Brian

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019