Not sure what the problem is...

Brian Dessent brian@dessent.net
Sat Apr 15 17:12:00 GMT 2006


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/



More information about the Cygwin mailing list