how to get device sd card path

Forums Programming cocos2d support (graphics engine) how to get device sd card path

This topic contains 7 replies, has 3 voices, and was last updated by  varedis 1 year, 1 month ago.

Viewing 8 posts - 1 through 8 (of 8 total)
Author Posts
Author Posts
March 14, 2013 at 6:55 am #247169

sandeep251986
@sandeep251986

hi

in my project i am downloading data from server after that i need to save downloaded data to iphone device memory.

here my problem is how to get device memory path to save the downloaded data.

can any one help me to get iphone device memory path.

March 14, 2013 at 7:29 am #399978

itlgames
Moderator
@itlgames

If you download on memory it means it’s stored on a variable, so no path. All download code I have ever implemented on iOS is on memory first then I save wherever I like. Perhaps you want to share that code cos your question is confusing.

March 14, 2013 at 7:52 am #399979

sandeep251986
@sandeep251986

my code is :

char szBuf[100]=”hello cocos2d”;

const char * path=”device sd card path/textFile.txt”;

File * fp=fopen(“”,”wb”);

if(fp)

{

fwrite(szBuf,1,sizeof(szBuf),fp);

fclose(fp);

}

from the above code i am trying to create textFile.txt in device sd card.

here my problem is to get sd card path;

how to get path of sd card

March 14, 2013 at 8:38 am #399980

itlgames
Moderator
@itlgames

Uh, sd card? You are posting on the wrong forums, you realise this is cocos2d in objective-c for iOS?

March 14, 2013 at 10:23 am #399981

sandeep251986
@sandeep251986

sorry itlgames

i know that was c++ code,i just tried with c++ code in cocos2d.

that code is working well in cocos2d

by using that code i created textFile.txt file also in simulator path (/users/…/iphone simulator/..caches/textFile.txt).

March 14, 2013 at 10:40 am #399982

varedis
Moderator
@varedis

What iOS are you using that has an SD card slot? I think you have picked up some knockoff lPhone

March 14, 2013 at 12:37 pm #399983

sandeep251986
@sandeep251986

sorry for wrong framing the question

i am trying to implement things which i implemented in android

in android i downloaded images from the server and saved that to device memory

card and creating folders in memory card.

like that i am trying in iphone also

here i am trying to create folder in device memory(not in project folder) and adding some text file/images

to that folder.

can i create files in device memory through pragmatically?

March 14, 2013 at 1:43 pm #399984

varedis
Moderator
@varedis

Each app runs in its own sandbox. You do not need to create separate folders in device memory to store things. Look in to NSDocuments

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.