Rainmaker Loch
Rainmaker Loch

Reputation: 91

C FOpen() Open Documents Directory iOS

I need help getting access to the documents directory using only C on iOS.

I have my .c file looking for a specific file in the application bundle. I have no problem accessing this file. It looks like this: fopen("filename",

Unfortunately, if I want to move that file to the documents directory, appending "/Documents/filename" doesn't work.

I know how to access the file using an objective-c class, easily, using filesystemrepresentation. But I don't know how to do it only in C. Any help would be greatly appreciated!

Thanks!

Upvotes: 1

Views: 883

Answers (1)

Rainmaker Loch
Rainmaker Loch

Reputation: 91

Fopen defaults to the directory that the executable file is in, ".app/" - on iOS.

I was able to get to the documents directory by making a char of the Current Working Directory and then removing the last couple characters of the char to get out of the ".app/" bundle and then appending the Documents path to the end of it.

Upvotes: 1

Related Questions