--
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting
Thanks advice and sample code.
Before, I used fputs() and fgets(). then, fputs() was not able to be
done though fgets() was able to be done. filepath permission is set to
777 beforehand.
Is the place of the folder path(.data/misc/cal/) bad? or should I
use fwrite() ?
I try by using fwrite.
sensors.c (file write test)
------------
#define CALIBRATION_FILE "/data/misc/cal/sensors.cal"
static native_handle_t* control__open_data_source(struct
sensors_control_context_t *dev)
{
LOGD("control__open_data_source()");
native_handle_t* handle;
int fd = open_input(O_RDONLY);
if (fd < 0) {
return NULL;
}
handle = native_handle_create(1, 0);
handle->data[0] = fd;
LOGD("open calibration file '%s'",CALIBRATION_FILE);
if ((fp = fopen(CALIBRATION_FILE, "rw")) == NULL) {
LOGE("Couldn't open '%s'",CALIBRATION_FILE);
} else {
fputs("ABCDEFGHIJKLMN", fp);
fclose(fp);
}
return handle;
}
--
nama
- Akash
I have not tried it yet you off the schedule. I'll try today or tomorrow.
--
nama
I'll try to fix it soon and report results again.
--
nama
I fixed fopen(filename, "rw") to fopen(filename, "w+").
then I can write to file.
simple mistake!! I am shame..
Thanks a lot.
--
nama