This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: just failing to open a file at specified location/directory
- From: "Matt Wozniski" <godlygeek at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 9 Feb 2007 16:21:14 -0500
- Subject: Re: just failing to open a file at specified location/directory
- References: <302106.31853.qm@web32409.mail.mud.yahoo.com>
On 2/9/07, winner wei wrote:
Hi,
when I wanted to open a file at a specified directory for writing, running it in Cygwin, the opening just failed. It is extremely simple, like this:
if((fp=fopen("C:\cygdrive\c\home\user\data\filename", "w"))==NULL)
You need to use posix-style paths. You're mixing and matching between
posix-style and DOS-style. What you almost certainly want is
if ( ( fp = fopen("/cygdrive/c/home/user/data/filename", "w") ) == NULL )
Note: No `C:' whatsoever. Cygwin addresses paths entirely
differently from DOS (and more like the rest of the world), so you
should never use the driveletter-colon terminology in cygwin.
~Matt
--
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/