In article <bca37bb1.0307240435.179818eposting.google.com> ,
[email]surfdargentfree.fr[/email] (Stéphane Vaxelaire) wrote:
fnfErr will also be returned if you are incorrectly specifying the path> I'm trying to test if a file exists and if not I try to create it in
> order to open it for writing.
> So I first use FSpGetFInfo to check if the file exists, then if
> iErr==fnfErr I try to create the file.
> In my example below cpath="/Users/surfdargent/test" and is an absolute
> My first problem : apparently even if the file exists (I just create
> it with 'vi') FSpGetFInfo returns fnfErr and then my prog tries to
> create the file.
> But now FSpCreate return -37 (bdNamErr) which should mean something
> like bad filename or bad volume.
> Did I do something wrong ?
or incorrectly converting it into an FSSpec.
Similarlly, if this spec is incorrect, you'll get an "bad name error"
when attempting to create it.
Your path is a Unix-style path, which is invalid for calls into the
Carbon file manager. I recommend MoreFiles.c and example code on
Apple's web site for more information on how to handle absolute paths.