Use a pathname that refers to a file in the main directory of your SD card. If you don't know what that is, then copy and paste this command into a Terminal window, then copy and paste the output into a reply and post it:
You can look for the name of your SD card in the listing output.
If you don't know how to make the pathname from the SD card's name, then tell us that, and someone can then tell you how to do it. They may ask you to copy and paste additional command-lines into a Terminal window.
http://en.wikipedia.org/wiki/Root_directory
http://en.wikipedia.org/wiki/Working_directory
http://en.wikipedia.org/wiki/Relative_path
You seem to think that the pathname in this NSString somehow refers to your SD card:
Code:
NSString *url= [NSString stringWithFormat:@"/demo.abc"];
I assure you, it doesn't.
The string "/demo.abc" is referring to a file located in the root directory of the disk you started OS X from. If there isn't a "demo.abc" file located there, then the fopen() will fail.
Is that what's happening? Your call to fopen() fails?
If you're learning from a book, post the title, author, and edition of the book. If you're learning from an online tutorial, post the actual URL. If you're learning from something else, describe exactly what it is.
If you're just pasting together code from random bits you find on the internet, I suggest a more structured approach, such as a book or tutorial that provides guidance.
I suspect that you don't understand how pathnames work on Unix. Since you haven't described your experience level, no one knows what you already know and what you don't.
If you don't tell us what you know, and how you're learning to program for OS X, then we can't give you specific answers, and we have to guess what the real problem is. Guessing is one of the worst ways of solving problems.