just failing to open a file at specified location/directory

Matt Wozniski godlygeek@gmail.com
Fri Feb 9 21:21:00 GMT 2007


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/



More information about the Cygwin mailing list