I have use the code like below
char *es_data;
fp_input = fopen(inp_path, "rb");
fseek(fp_input, 0, SEEK_END);
file_size = ftell(fp_input);
fseek(fp_input, 0, SEEK_SET);
es_data = (char*)malloc(file_size);
fread(es_data, 1, file_size, fp_input);
I have a file of 185mb, i.e., file_size = 190108334 bytes. For this file, malloc is crashing, and program is getting struck at this stage.
If i use any other file of lower size, it works fine.
What can I do ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…