C的数据往JAVA层传递,一般数据会把它变为char*类型。
读取文件是,有time_t类型,其实就是long,但是想直接传日期上来,那就类似如下代码:
struct stat buf;
stat(addpath, &buf);
// LOGI("=========mm====path========%d", buf.st_size);
char string[25];
sprintf(string, "%d", buf.st_size);
const char *separate = "|";
strcat(s, separate);
strcat(s, string);
// LOGI("=========mm====paths========%s",string);
char time_string[50];
time_t timer;
struct tm *tblock;
timer = buf.st_ctime;
tblock = localtime(&timer);
sprintf(time_string, "%s", asctime(tblock));
buf.st_size保存了文件大大小,是多少byte.
buf.st_ctime就是时间(属性)
一般数据格式化处理都用sprintf方法。