Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

brcondor

macrumors newbie
Original poster
Feb 12, 2012
1
0
Hi all.
I'm new to this forum.
I'm going slightly mad for a little problem.
I'm programming with Xcode using C language. I need to open a file and then to read it. I use fopen to open and fread to copy the informations inside this file.
The problem is with fopen: how can I find the correct address for my file? I mean, i tried to just copy the address starting from /Users/name_users/fullpath/myfile.jpg but the pointer point to Null(it means, nothing happens).
I tried to check if the address is correct from the command line but the answer is my folder doesn't exist: "iMac-di-andrea:~ andreacondorelli$ /Users/andreacondorelli/prova C/Prova/Prova/compressione/Compressione/Compressione
-bash: /Users/andreacondorelli/prova: No such file or directory
iMac-di-andrea:~ andreacondorelli$ /"

If I try to open a file from desktop, i read "/Users/andreacondorelli/documents/test.jpg
-bash: /Users/andreacondorelli/documents/test.jpg: Permission denied"

Maybe the problem is with the permission.
The C code is
FILE *fp1;
char nome[100];
[...code here ...]
fp1=fopen(nome,"rb");
 
There's a tiny little bit missing in the C code. I wonder why you didn't post it. Is it because you are absolutely sure that that part of the code is bug free? That's usually where you find the bugs.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.