无法关闭文件?? [英] can't close a file??

查看:93
本文介绍了无法关闭文件??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




当我编译程序时,我得到了一个分段错误如下:


程序接收信号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

推荐答案



" Michelle" < MI ************ @ hotmail.com>在消息中写道

新闻:3F ************** @ hotmail.com ...

"Michelle" <mi************@hotmail.com> wrote in message
news:3F**************@hotmail.com...

<当我编译程序时,我得到了一个分段错误如下:

程序收到信号SIGSEGV,分段错误。
来自/ lib / i686 / libc的_int_free()中的0x42074bd0。 _6

来自/lib/i686/libc.so.6的_int_free()中的#0x42074bd0
来自/lib/i686/libc.so的free()中的#0x42075a5c。 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

错误是由函数fclose引起的。


极不可能。更可能的是,你的代码出现了问题




在程序中,我打开一个文件,


您是否检查了''fopen()''的返回值?

从中读取一些数据,


您是否检查过您的读数成功/失败的操作?

然后关闭它。我刚刚使用gdb检查过。
数据可以正确读取。然而,当谈到fclose时,会出现一个seg故障。可能某人给我一些可能导致fclose失败的想法?提前谢谢
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.
Highly unlikely. More likely, there''s something wrong
with your code.

In the program, i open a file,
Did you check the return value from ''fopen()''?
read some data from it,
Did you check your read operations for success/failure?
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.




你在第47行有一个错误。(也就是我们怎么知道没有

看到任何代码?)。


-Mike



You have a bug on line 47. (I.e. how the *** can we know without
seeing any code?).

-Mike





Michelle写道:


Michelle wrote:



当我编译程序时,我得到了如下的分段错误:

程序收到信号SIGSEGV,分段错误。
来自/lib/i686/libc.so.6的_int_free()中的0x42074bd0
来自/lib/i686/libc.so.6的_int_free()中的#0x42074bd0
#1 0x42075a5c in free()from /lib/i686/libc.so.6
#2 0x4206293c in fclose @@ GLIBC_2.1()from /lib/i686/libc.so.6#4 0x08049867 in generate_table(dif = 0xbfffde80)at redeploy.c:725
#5 0x08048786 in main()at redeploy.c:63
#6 0x420158f7 in _llcc_start_main()from /lib/i686/libc.so.6

错误是由函数fclos引起的即在程序中,我打开一个文件,从中读取一些数据,然后关闭它。我刚刚使用gdb检查过。
数据可以正确读取。然而,当谈到fclose时,会出现一个seg故障。可能某人给我一些可能导致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




如果您向我们展示您的代码,将会有所帮助。

-

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




" Michelle" < MI ************ @ hotmail.com>在消息中写道

新闻:3F ************** @ hotmail.com ...

"Michelle" <mi************@hotmail.com> wrote in message
news:3F**************@hotmail.com...

<当我编译程序时,我得到了一个分段错误如下:

程序收到信号SIGSEGV,分段错误。
来自/ lib / i686 / libc的_int_free()中的0x42074bd0。 _6

来自/lib/i686/libc.so.6的_int_free()中的#0x42074bd0
来自/lib/i686/libc.so的free()中的#0x42075a5c。 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

错误是由函数fclose引起的。


极不可能。更可能的是,你的代码出现了问题




在程序中,我打开一个文件,


您是否检查了''fopen()''的返回值?

从中读取一些数据,


您是否检查过您的读数成功/失败的操作?

然后关闭它。我刚刚使用gdb检查过。
数据可以正确读取。然而,当谈到fclose时,会出现一个seg故障。可能某人给我一些可能导致fclose失败的想法?提前谢谢
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.
Highly unlikely. More likely, there''s something wrong
with your code.

In the program, i open a file,
Did you check the return value from ''fopen()''?
read some data from it,
Did you check your read operations for success/failure?
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.




你在第47行有一个错误。(也就是我们怎么知道没有

看到任何代码?)。


-Mike



You have a bug on line 47. (I.e. how the *** can we know without
seeing any code?).

-Mike


这篇关于无法关闭文件??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆