小编edd*_*d91的帖子

为什么这个缓冲区指向不可寻址的字节?

编辑:感谢repliers我已将fread更改为(... sizeof buffer,1,...),但现在我在valgrind中收到此错误:

==2409== Invalid read of size 4
==2409==    at 0x51AB8D0: fread (iofread.c:41)
==2409==    by 0x4007B6: main (recover2.c:31)
==2409==  Address 0x5502000 is not stack'd, malloc'd or (recently) free'd
==2409== 
==2409== Use of uninitialised value of size 8
==2409==    at 0x51B8787: _IO_sgetn (genops.c:495)
==2409==    by 0x51AB93E: fread (iofread.c:42)
==2409==    by 0x4007B6: main (recover2.c:31)
==2409== 
==2409== Invalid read of size 8
==2409==    at 0x51B8787: _IO_sgetn (genops.c:495)
==2409==    by 0x51AB93E: fread (iofread.c:42)
==2409==    by 0x4007B6: main (recover2.c:31)
==2409==  Address 0x40 is not …
Run Code Online (Sandbox Code Playgroud)

c sizeof fread

2
推荐指数
1
解决办法
871
查看次数

标签 统计

c ×1

fread ×1

sizeof ×1