• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: fopen
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fopen


  • Subject: Re: fopen
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Fri, 28 Dec 2007 15:23:49 +0100


Le 28 déc. 07 à 15:03, email@hidden a écrit :

Le 28 déc. 07 à 10:35, email@hidden a écrit :

Hi

With codewarrior I was using the fopen fonction with

file = fopen("HD:Folder1:Folder2:MyFiles",mode);
fprintf(file, ....

now with XCode
this generate a file named "HD:Folder1:Folder2:MyFiles" which is create in application folder if launch from XCode and in "HD" if It's launch from the finder.
I've try to use the fonction SetVol but with no success.


I know I could use FSOpen, FSWrite but then I'll have thousand modification in my code.

Any idea?

Regards
Vincent HOFFMANN

Using HFS path with lib c function was a CodeWarrior feature. You should use POSIX path with lib c functions now.


fopen("/Folder1/Folder2/MyFiles", mode);

You also have to update your code, but it will probably need less change than using FSOpen and Co.

Regards
Jean-Daniel Dupas

Thanks this will save me a lot of work. But what is the name if the file is on a other disk "HD2"?
Vincent

If you need more info about HFS to POSIX convertion, you can search in the Carbon, Cocoa and Xcode lists archives. There is a lot of threads about it.
The general way is to use CFURL API:


urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, inRef, kCFURLHFSPathStyle, isDirectory);
outRef = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);


But
"In addition, the right answer will depend on how you are obtaining the paths. You might be able get the paths as POSIX paths originally, which is preferable for multiple reasons."



_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >fopen (From: email@hidden)
 >Re: fopen (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Compling with gcc 3.3 under Leopard?
  • Next by Date: Re: Lost markers after Reference Library update
  • Previous by thread: Re: fopen
  • Next by thread: Lost markers after Reference Library update
  • Index(es):
    • Date
    • Thread