if (filep != NULL)
{
char buffer[500];
size_t size;
struct stat statBuff;
int status = stat(“filename”, &statBuff);
if (status == 0)
{
int numRead = 0;
numRead = fread(buffer, 500, 1, filep);
}
fclose(filep);
//other code.
}
This crashes during the fread call. If I reduce the size to 100 bytes it mostly passes, but if I reduce it to one byte and put it in a for loop to read one byte over and over until it reaches size, it works just fine and I get all my data. In this case, my file is only 374 bytes, so I know I’m not running off the end of the buffer.
Has anyone else seen this? This is with Legato 7.11 (R7) with a WP76xx system.
Hi @spastor,
No, it’s not sandboxed as there are things I can’t do under sandboxed mode. It doesn’t appear to be a memory issue as I can either new, or declare a stack variable to contain the bytes read, and as long as I fread it one byte at a time, then all is well.
Here is the .adef, just standard stuff except that it’s not sandboxed.