File Manipulation Functions (fileread, open, filewrite, etc.) Not Working In Android.

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
Post Reply
BenHaichim
Posts: 1
Joined: March 29th, 2019, 1:23 am

File Manipulation Functions (fileread, open, filewrite, etc.) Not Working In Android.

Post by BenHaichim »

Need assistance regarding the above matter.

I have a CSPro application that needs to open a text file, and read its content. Below is the snippet taken from CSPro help:

file f;
numeric n;

n = setfile(f, filepath);

errmsg ("n = %d", n);

From PC, n = 1 (successful)
From Android, n = 0 (unsuccessful)

With regards to filepath, I verified (using other error messages) that the text file path is correct and the file is actually present at the particular locatin (in both PC and android).

Did I miss something out? How can I read a text file (without dictionary) in an Android environment?

Many thanks in advance.
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: File Manipulation Functions (fileread, open, filewrite, etc.) Not Working In Android.

Post by Gregory Martin »

We use file operations a lot in the Android environment, so I'm not sure what the problem is. If you declare file f in PROC GLOBAL, you'll be able to associate f with a file when specifying your file associations. If you specify the filename there, rather than by using setfile, are you able to perform operations on the file?

Also, try calling fileexist(filepath) and see what the return value is. That will tell you if CSEntry can't even find the file, or if the problem is in opening the file.
Post Reply