← Back to context

Comment by groundzeros2015

6 hours ago

> file on a Wifi network drive,

I would simply not mmap this.

> If you're not prepared to handle a memory access exception when you access the mapped file, don't use mmap.

fread can fail too. I don't know why you would be prepared for one and not the other.

Because you're way deep down the call stack in some function that happened to take in a pointer, far far away from the code that opened the file.

  • If that's your program design then fread is not a substitute. Because you would need to pass in the FILE* pointer to all those calls.

    And what are you hoping to do in those call stacks when you find an error? Can any of that logic hope to do anything useful if it can't access this data? Let the OS handle this. crash your program and restart.