问题描述
当我编译程序时,我得到了一个分段错误如下:
程序接收信号SIGSEGV,分段错误。
来自/lib/i686/libc.so.6的_int_free()中的
0x42074bd0
来自/ lib / i686 /的_int_free()中的
#0 0x42074bd0 libc.so.6
#1 0x42075a5c in free()from /lib/i686/libc.so.6
#2 0x4206293c in fclose @@ GLIBC_2.1( )来自/lib/i686/libc.so.6
#3 0x08049a76 in getNewDeploy(deploy = 0x804b450)at redeploy.c:839
#4 0x08049867 in generate_table( dif = 0xbfffde80)在redeploy.c:725
#5 0x08048786 in main()at redeploy.c:63
#6 0x420158f7 in __libc_start_main()from / lib / i686 / libc.so.6
错误是由函数fclose引起的。在程序中,我打开一个文件,
从中读取一些数据,然后关闭它。我刚刚使用gdb检查过。
数据可以正确读取。然而,当谈到fclose时,出现了一个段错误
。可能某人给我一些可能导致fclose失败的想法?谢谢
提前。
最好。
Michelle
Hi,
When i compiled a program, i got a segmentation fault as follows:
Program received signal SIGSEGV, Segmentation fault.
0x42074bd0 in _int_free () from /lib/i686/libc.so.6
#0 0x42074bd0 in _int_free () from /lib/i686/libc.so.6
#1 0x42075a5c in free () from /lib/i686/libc.so.6
#2 0x4206293c in fclose@@GLIBC_2.1 () from /lib/i686/libc.so.6
#3 0x08049a76 in getNewDeploy (deploy=0x804b450) at redeploy.c:839
#4 0x08049867 in generate_table (dif=0xbfffde80) at redeploy.c:725
#5 0x08048786 in main () at redeploy.c:63
#6 0x420158f7 in __libc_start_main () from /lib/i686/libc.so.6
The error was caused by function fclose. In the program, i open a file,
read some data from it, then close it. I just checked using gdb. The
data can be read correctly. however when it comes to fclose, a seg fault
appears. Could sb. give me some ideas what may cause fclose fail? Thanks
in advance.
Best.
Michelle
推荐答案
你在第47行有一个错误。(也就是我们怎么知道没有
看到任何代码?)。
-Mike
You have a bug on line 47. (I.e. how the *** can we know without
seeing any code?).
-Mike
如果您向我们展示您的代码,将会有所帮助。
-
Fred L. Kleinschmidt
波音助理技术研究员
技术架构师,通用用户界面服务
M / S 2R-94(206)544-5225
It would help if you showed us your code.
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225
你在第47行有一个错误。(也就是我们怎么知道没有
看到任何代码?)。
-Mike
You have a bug on line 47. (I.e. how the *** can we know without
seeing any code?).
-Mike
这篇关于无法关闭文件??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!