PDA

View Full Version : [Solved] c++ segfault


graudeejs
February 12th, 2009, 07:46
I get segfault at
f s c a n f
i don't understand why i get segfault

input.dat has:
10 Xasdf



sorry, when i write that normal, i get error.

anemos
February 12th, 2009, 09:38
That's because you haven't allocated space for name.
Either use the new operator or define its size statically i.e. char name[WHATEVER].

dap
February 12th, 2009, 20:46
You should learn about C++ strings and iostreams or stick to C.
Here is a good resource about C++ : http://bruce-eckel.developpez.com/livres/cpp/ticpp/.

hydra
February 13th, 2009, 00:36
I would recommend to start learning C instead of C++ :)

fonz
February 13th, 2009, 01:03
I would recommend to start learning C instead of C++ :)

Second that!

Alphons (admitting that tastes may differ though)