Reading and writing from/to files not in project folder in C?

Thread Starter

blah2222

Joined May 3, 2010
582
Hello,

I am running NetBeans on my Mac OS X and have written a program in C. I am using file I/O and I would like to have the ability of reading from files outside the directory as well as write files to specific folders outside the directory.

Does anyone know what the syntax for that is?

P.S. It would also be cool if I could run the application without having to go through NetBeans,is there any way that I could go about doing this on a Mac using some sort of executable file, (not in Terminal)?

Thanks a bunch!
JP
 

kavli

Joined Aug 1, 2011
23
How are you opening your output files? fopen?
If you prepend the path with a leading /, then you give the absolute path.
Of course you need write permissions for the path you're giving.

-- K
 
Top