linux - C++ 64 bit file i/o gotchas -


i found interesting bug when converting c++ app 32 64 bit linux. our filestore class implements saving/restoring structs to/from file. calls fopen() , fclose() before , after each operation except in 1 method. in (buggy) method on 32-bit platforms, can fseek() , fread() without error though file has been fclose()'d other methods. on 64-bit platform crashes every time on fread(). guess on 32-bit platform underlying file struct persists after fclose() can still accessed. have further info on why difference , other gotchas 64bit file i/o?

it sounds undefined behavior me. 64 bit vs 32 bit aspect of question red herring. compiler free erase home directory, or maybe file federal tax return in such circumstances.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -