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

kay.altos

macrumors newbie
Original poster
in c++ trying to do it this way, but it doesen't help

int logA = 0;
FILE* f = fopen("~/Desktop/rr.log","w");
int a = errno;
fprintf(f,"%d", ++logA);
fclose(f);

errno returns 2 - "No such file or directory", there is no file present but it should be created.

please advise
 
use a fully qualified path ("/Users/yourname/Desktop/rr.log") or import environment variables to get $HOME (use getenv from cstdlib or stdlib.h if you are using C, type "man 3 getenv" in Terminal to see usage)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.