1. 경로 생성
#include QTextStream #include QDir #include QObject ... // Create a new directory called files/text in the data directory. QDir dir; // New QDir objects default to the application working directory. dir.mkpath("/accounts/1000/shared/misc/android/MoneyManager/import/");
2. 파일 쓰기
QFile textfile("/accounts/1000/shared/documents/saveSetting.txt"); textfile.open(QIODevice::WriteOnly | QIODevice::Text); QTextStream streamFileOut(&textfile); streamFileOut << trUtf8("%1\n").arg(m_filter); streamFileOut.flush(); textfile.close();
3. 파일 읽기
QFile textfile("/accounts/1000/shared/documents/saveSetting.txt"); textfile.open(QIODevice::ReadOnly | QIODevice::Text); if(textfile.isOpen()){ QTextStream stream ( &textfile ); QString tmp; tmp = stream.readLine(); while(!tmp.isNull()&&tmp.contains("\t")) { QStringList tmpList = tmp.split("\t"); QVariantMap entry; entry["name"] = tmpList[0]; entry["group"] = tmpList[1]; entry["spliter"] = tmpList[2]; entry["card1"] = tmpList[3]; entry["card2"] = tmpList[4]; entry["where1"] = tmpList[5]; entry["where2"] = tmpList[6]; entry["money1"] = tmpList[7]; entry["money2"] = tmpList[8]; m_model->insert(entry); tmp = stream.readLine(); } } textfile.close();
4. 파일 삭제
QFile textfile("/accounts/1000/shared/documents/saveSetting.txt"); textfile.open(QIODevice::WriteOnly | QIODevice::Text); textfile.remove();
5. 내용 지우기
QFile textfile("/accounts/1000/shared/documents/saveSetting.txt"); textfile.open(QIODevice::WriteOnly | QIODevice::Text); textfile.resize(0); textfile.close();
※ 참고한 사이트
1. Native SDK for BlackBerry 10 - File system access
https://developer.blackberry.com/native/documentation/device_platform/data_access/file_system.html
2. http://egloos.zum.com/limjunsung/v/854389
Tistory | 티스토리 방명록 프로필 + 랜덤 기본 이미지 (1) | 2017.08.27 |
---|---|
BlackBerry | 프로젝트 생성시 수정할 사항 (0) | 2017.04.10 |
jQuery | 동영상 썸네일 (0) | 2017.03.17 |
BlackBerry | 개발환경 (0) | 2016.11.15 |
BlackBerry | SystemDialog 추가하기 (0) | 2016.10.27 |
BlackBerry | 버전 정보 (version info) 추가 (0) | 2016.10.27 |
jQuery | 이미지 숨기기 (0) | 2016.10.16 |
VBA | 셀 값 클립보드로 복사하기 (0) | 2016.10.15 |