delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/02/09/16:22:21

X-Spam-Check-By: sourceware.org
Message-ID: <17393e3e0702091321k7096abc9gcd0abe0ddd92a616@mail.gmail.com>
Date: Fri, 9 Feb 2007 16:21:14 -0500
From: "Matt Wozniski" <godlygeek AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: just failing to open a file at specified location/directory
In-Reply-To: <302106.31853.qm@web32409.mail.mud.yahoo.com>
MIME-Version: 1.0
References: <302106 DOT 31853 DOT qm AT web32409 DOT mail DOT mud DOT yahoo DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

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/

- Raw text -


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