# c++ segfault



## graudeejs (Feb 12, 2009)

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 (Feb 12, 2009)

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 (Feb 12, 2009)

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 (Feb 12, 2009)

I would recommend to start learning C instead of C++


----------



## fonz (Feb 13, 2009)

hydra said:
			
		

> I would recommend to start learning C instead of C++



Second that!

Alphons (admitting that tastes may differ though)


----------

