Mail Archives: cygwin/1997/11/09/23:56:36
On 9 Nov 97 at 13:16, Scott Warner <swarnerx3 AT acadia DOT net> wrote:
> I am writing a theorem generator. In the function that asks for your
> theorem the program seems to crash. The code is:
>
> cout << "\nEnter your theorem : ";
>
> cin.getline(m_str, sizeof(m_str)-1);
>
> m_str is a class member of a predetermined size. Here is the DOS window
> output after it crashes:
<snip><snip><snip><snip><snip><snip><snip><snip><snip><snip><snip><snip><snip>
> It goes on to list a detailed stack trace. Two questions: why does it
> crash? cin.getline is used correctly. Is it out of stack space? I do not
> allocate m_str using new, just char m_str[MAX_BUF], where MAX_BUF is 120.
>
> Third: does a debugger come with gun-win32? I have used Codeview several
> times.
>
Third :-) There is a debugger in cygwin32, a. k. a. gnu-win32. It is called
gdb and is the standard GNU debugger. In cygwin it has a GUI face, but the
same commands. It is very useful -- particularly in cases like yours --, but
it still demands some finishing touches. Get acquainted with it through the
"help" command, typed at the user prompt.
First and second :-) Usually the cygwin products work, even when need
finishing touches. So, the first thing to check is your use of <iostream.h>
classes. My personal experience with it was not very good. I hope yours is
better. :-)
Run your program through gdb and it will show the line where it broke. Then a
command named "where" will display the stack of functions when the program
broke.
Don't forget to compile and link with the -g flag enabled.
Best regards,
++Hilton
----
Hilton Fernandes
hfernandes AT geocities DOT com
http://www.geocities.com/SiliconValley/Lakes/5657
URLs and help on C++ programming and Object-Oriented Design
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -