This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: just failing to open a file at specified location/directory


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]