In GDB I get:
(gdb) backtrace 0 0xb7d91544 in strcpy () from /lib/libc.so.6 1 0x08048982 in ISBN::ISBN(char const*, ISBNPrefix&) () 2 0x08048d4a in main () (gdb)
From this code:
ISBN::ISBN(const char* str, ISBNPrefix& list) {
if(isValid(str)) {
isSet = true;
sprintf(*isbnStr,"%s",str);
}
}
What exactly would be causing this?
isbnStr is created in the header:
class ISBN
{
...
char* isbnStr[11];
...
Any ideas on what I could be doing here to cause this seg fault?
The call in main is:
ISBN* isbn = new ISBN("7999999008",*prefix);
isbnStr is an array of strings (or more specifically character pointers), not an array of characters. I think you meant to do
char isbnStr[11];