Languages

Menu
Sites
Language
Reading from a file

In data folder I have file input.txt. I have path to this file - app_get_data_path() + "input.txt". But both fstream and fgets didn't work. How can I fix this?

Responses

3 Replies
Hermet Park

Please be sure the point of this problem between file open or data reading.

please see the full path in the runtime whether it's correct or not first.

for tip,

you could make the full path simply,

char buf[PATH_MAX];

snprintf(buf, sizeof(buf), "%s/%s", app_get_data_path(), "input.txt");

Jeongsu Kim

app_get_data_path() returns allocated memory. so you have to make a variable to hold it and free it after use.

Alex Dem

fyi, about fstream
https://developer.tizen.org/forums/general-support/including-cc-libs
Alexey.