Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 39
Registered: ‎01-21-2014
My Device: Blackberry curve
My Carrier: 918547626119
Accepted Solution

Create a File on SD Card

Hi,

 

I want to know how to create a folder and a file inside an SD Card and write data on to the file.

I tried

          QDir *dir = new QDir(QDir::currentPath() + "/../../removable/sdcard/MyFolder"); 

          qDebug() << "path exists? " << dir->exists();

and it shows false,

 

I tried

          QFile *zipFile = newQFile("QDir::currentPath() + "/../../removable/sdcard/MyFolder/filename.zip");

          qDebug()<<zipFile->exists();

and it also showed false;

 

I have checked access_shared and I'm able to get the sdcard path, please help

 

thank & regards

Vishnu Skumar

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Create a File on SD Card

You use QDir::mkdir() to make a folder...

 

Check out the section on Creating new files and directories

 

http://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_syste...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 39
Registered: ‎01-21-2014
My Device: Blackberry curve
My Carrier: 918547626119

Re: Create a File on SD Card

[ Edited ]

Thanks 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Create a File on SD Card

QFile is similar just use open() with the correct attributes...

http://qt-project.org/doc/qt-4.7/qfile.html

QDir and QFile are just classes used to interface to the I/O File System.

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.