Use FileInputStream read file in Android

Please post support and help requests here.
yayaigo
Posts: 2
Joined: 22 Nov 2013, 09:00

Use FileInputStream read file in Android

Postby yayaigo » 22 Nov 2013, 09:15

I try to read a "test.Jasonp" file from "assets/Json/" folder in android platform
I set path = "assets/Json/test.Jsonp" , but I get FileException:File not found
I also try "Json/test.Jsonp" , not work.

This is my code below:
try{
Poco::FileInputStream source(path);
....

} catch (FileException& e) {
CCLog("%s FileException:%s",path.c_str(),e.what());
}

How to fix that?
Maybe need set path to a absolute path?

Regards.

guenter
Posts: 1190
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Use FileInputStream read file in Android

Postby guenter » 22 Nov 2013, 10:23

Maybe need set path to a absolute path?


Very likely.

yayaigo
Posts: 2
Joined: 22 Nov 2013, 09:00

Re: Use FileInputStream read file in Android

Postby yayaigo » 25 Nov 2013, 05:09

But I don't know what the absolute path is in asset folder.
I also try "assets:/Json/test.Jsonp" and "file:///android_asset/Json/test.Jsonp"
but this is still not working
Anybody people do try success?


Return to “Support”

Who is online

Users browsing this forum: No registered users and 2 guests