X-Spam-Check-By: sourceware.org Message-ID: <17393e3e0702091321k7096abc9gcd0abe0ddd92a616@mail.gmail.com> Date: Fri, 9 Feb 2007 16:21:14 -0500 From: "Matt Wozniski" 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 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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/