| UNIX/Linux Forum Archives · Rules and Guidelines · Disclaimer |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
![]() ![]() ![]() |
| poojap123 |
Posted: Jul 28 2004, 08:48 PM
|
|
Newbie ![]() Group: Members Posts: 1 Member No.: 408 Joined: 28-July 04 |
HI,
while I am running my program I am getting segmentation fault... this is the back trace from gdb ... I am having hard time with this segmentation faukt... please anyone suggest me how can i fix it up... i am not a computer science student.. i don't know so many technical stuff.. please help me... Program received signal SIGSEGV, Segmentation fault. 0x4014f46d in __printf_fp () from /lib/i686/libc.so.6 (gdb) bt #0 0x4014f46d in __printf_fp () from /lib/i686/libc.so.6 #1 0x4014a6be in vfprintf () from /lib/i686/libc.so.6 #2 0x4016b014 in vsnprintf () from /lib/i686/libc.so.6 #3 0x40152ef4 in snprintf () from /lib/i686/libc.so.6 #4 0x4008c617 in bool std::has_facet<std::messages<wchar_t> >(std::locale const&) () from /usr/lib/libstdc++.so.5 #5 0x4007e9ae in std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_convert_float<double>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, char, double) const () from /usr/lib/libstdc++.so.5 #6 0x4007e2c2 in std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const () from /usr/lib/libstdc++.so.5 #7 0x400926bc in std::ostream::operator<<(double) () from /usr/lib/libstdc++.so.5 #8 0x0804b2c3 in PLFFP::leaving_var1() (this=0xbffff5f0) at tPLFFP.cpp:465 |
| jim mcnamara |
Posted: Jul 29 2004, 02:28 PM
|
|
User Level: 2 ![]() ![]() Group: Members Posts: 28 Member No.: 320 Joined: 4-June 04 |
The error is caused by a call to sprintf() which expects a NULL-terminated string.
The string is not null terminated. In this case formatting output for ostream is the problem. Look for a string which is too large for the size of the declared string. |
| arunkumar |
Posted: Oct 15 2004, 04:32 AM
|
|
Newbie ![]() Group: Members Posts: 6 Member No.: 577 Joined: 13-October 04 |
Hello,
Segmentation faults comes with strings or character only.If you have string or character variable check it out. The size of it cannot take the information. make the size to be greater or you may redeclare a same variable. arunkumar |
| rahul200676 |
|
|
Newbie ![]() Group: Members Posts: 2 Member No.: 856 Joined: 13-March 05 |
Hi,
I will saw, segmentation fault occurs generally when one program tries to read or write to a memory area which is not belonging to that program. If u r working with string, see if the string size is beyond the limit of the memory space of the array, or if u have the terminating character in the end of the string. No need to mention that you r not a computer science student. Rahul |
![]() |
![]() ![]() ![]() |