Hi, i'm messing around with files in C and i've got a little question. I've done a little bit of searching but I can't seem to come up with anything pertaining to my question in a Unix/Linux environment.
I want to create a file in a subdirectory, but I'm not exactly sure how to.
I know to create a file in the current directory, I have to do the following:
But how would I do a subdirectory. Suppose i'm at r00t and I want to write to a file in a subdirectory affectionately named, "a".Code:FILE *ofp = fopen("Blah","w");
I've tried:
which just yields a segmentation fault error.Code:FILE *ofp = fopen("//a//Blah","w");
This is something I should have been able to find w/ google, but I've been unsuccessful. Thanks for any help.



LinkBack URL
About LinkBacks


