Discuz! Board

 

 

Search
Discuz! Board Forum Integration Questions Reading Plist/Xml Files
Author: uzair187
go

Reading Plist/Xml Files

Rank: 4

Post on 2011-6-16 15:47 |All posts
We have file operations. Check file section in our API_reference.pdf,   manual.pdf.

If you want to modify the read in content, which is a Dict, use Dict api. It is in Dict section of API_reference.pdf.

Rank: 4

Post on 2011-6-21 21:33 |All posts
Can you please give me an example of how to read/edit and create a new file in the res folder at runtime?  

Rank: 4

Post on 2011-6-22 09:55 |All posts
There is sample code in the manual.pdf, Chapter9: Files
var handler = c_file_open("test");
c_file_op(C_FILE_WRITE,handler,"This is a test file");
var content = c_file_op(C_FILE_READ,handler);

And there is a sample project in projects\demo. It shows lots of APIs including file

Rank: 4

Post on 2011-6-27 16:33 |All posts
var handler = c_file_open("test");
c_file_op(C_FILE_WRITE,handler, testDictionary);

doesn't let me write, is there any other method? ..

Rank: 4

Post on 2011-6-27 16:36 |All posts
what is testDictionary?

Rank: 4

Post on 2011-6-27 18:13 |All posts
Its a dictionary ... But I have been able to solve the issue by passing str(testDictionary) ..

But I have another question .. I have a file test.txt in res folder and I want to open and read its content, I tried
var handler = c_file_open("test",0);
and
var handler = c_file_open("test",1);
nothing works ..

Rank: 4

Post on 2011-6-28 10:23 |All posts
Sorry for the inconvenience. We just add a API to do this c_res_file(filename).

var handler = c_res_file("a.txt");
trace(handler);
var content = c_file_op(C_FILE_READ,handler);
trace(content);

c_file_open() opens a file on the phone storage, not in APK

Rank: 3Rank: 3

Post on 2011-6-28 22:23 |All posts
Can we detect subfolders in the res folder with c_res_file("foldername")? Is there any other way to detect the existance of subfolders by name?

Rank: 4

Post on 2011-6-29 09:44 |All posts
c_res_file or c_file_open must take a file name not a folder name.

If the file does not exist, c_res_file returns null.

You may use files to know whether their folders exist.

Rank: 3Rank: 3

Post on 2011-6-29 13:54 |All posts
Ok, but that confuses me a little...c_file_op(C_FILE_LIST, file_handler) "Return a list of file handlers in a directory." so I'm assuming the handler passed in is for a directory so it returns the contents...
Security Q&A Change Security code Change

Archiver|Comsenz Inc.

All time is GMT+8, 2013-5-23 07:37 , Processed in 0.035202 second(s), 10 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.