By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Failure while assigning values to a variable: Aborted

P: n/a
Hi!
string* pWordlist;
pWordlist = new string[elements];

for(int i=0; i < elements; i++)
***pWordlist[i] = "";

...

pWortliste[tmpelement][previous] = buf[i];
aborts ("Aborted") at

tmpelement = 13;
previous = 0;

where until that point everything went fine (last values for both
variables were 12). tmpelement is still fairly lower than elements is.

"strace ./a.out" says

write(1, "tmpelement: 13 previous"...,
38tmpelement: 13 vorgaenger: 0) = 38
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
getpid() = 32184
kill(32184, SIGABRT) = 0
--- SIGABRT (Aborted) @ 0 (0) ---
+++ killed by SIGABRT +++

What the hell is wrong with this?

best regards
Moritz Beller
--
web http://www.4momo.de
mail momo dot beller at t-online dot de
gpgkey http://gpg.notlong.com
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sun, 7 Nov 2004 17:35:36 +0100
Moritz Beller <mo*****************@t-online.de> wrote:
string* pWordlist;
pWordlist = new string[elements];

for(int i=0; i < elements; i++)
***pWordlist[i] = "";

...

pWortliste[tmpelement][previous] = buf[i];


FYI: Concatenating strings with pWordlist[tmpelement] += buf[i];

best regards
Moritz Beller
--
web http://www.4momo.de
mail momo dot beller at t-online dot de
gpgkey http://gpg.notlong.com
Jul 22 '05 #2

P: n/a

"Moritz Beller" <mo*****************@t-online.de> wrote in message
news:cm*************@news.t-online.com...
Hi!
string* pWordlist;
pWordlist = new string[elements];

for(int i=0; i < elements; i++)
pWordlist[i] = "";

....

pWortliste[tmpelement][previous] = buf[i];
aborts ("Aborted") at

tmpelement = 13;
previous = 0;

where until that point everything went fine (last values for both
variables were 12). tmpelement is still fairly lower than elements is.
What the hell is wrong with this?

Several things could be wrong with it. pWortliste[tmpelement] could be a
zero length string, it certainly started as a zero length string. buf could
be an invalid pointer, or buf could be an array but smaller than i.

All of these are possible.


Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.