c++ segfault

graudeejs

Son of Beastie

Reaction score: 695
Messages: 4,615

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

Member

Reaction score: 16
Messages: 58

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].
 

fonz

Son of Beastie

Reaction score: 369
Messages: 2,560

hydra said:
I would recommend to start learning C instead of C++ :)
Second that!

Alphons (admitting that tastes may differ though)
 
Top