#include <jni.h>
#include <stdlib.h>
#include <stdio.h>
#include "bios.h"
#include <string.h>
#include <sys/stat.h>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include "bios.h"
#include <string.h>
#include <sys/stat.h>
#include <fstream>
char * szBuf;
FILE *fp = fopen( "D:/jk.dat", "r" );
if( fp != NULL ) {
//获取文件大小-------------------start
long int save_pos;
long size_of_file;
/* Save the current position. */
save_pos = ftell( fp );
/* Jump to the end of the file. */
fseek( fp, 0L, SEEK_END );
/* Get the end position. */
size_of_file = ftell( fp );
/* Jump back to the original position. */
fseek( fp, save_pos, SEEK_SET );
fclose(fp);
//获取文件大小-------------------end
std::ifstream fin("D:/jk.dat", std::ios::binary);
szBuf = new char[size_of_file];
fin.read(szBuf, sizeof(char) * size_of_file);
fin.close();
}
如果在jni编译头文件fstream不存在添加如下文件:Application.mkAPP_STL := gnustl_static